Skip to content

Commit c31bb8a

Browse files
alexkozyCommit Bot
authored andcommitted
[debug] retire ScriptWrapper
- rewritten couple tests, - migrated JSMessageObject to real Script instead of wrapper, - removed wrapper. R=yangguo@chromium.org TBR=ulan@chromium.org Bug: v8:5530 Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;luci.chromium.try:linux_chromium_rel_ng;master.tryserver.blink:linux_trusty_blink_rel Change-Id: Ia95492344c7b5978a940e2ab007b389384537148 Reviewed-on: https://chromium-review.googlesource.com/1112851 Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Cr-Commit-Position: refs/heads/master@{#54274}
1 parent 37dcd83 commit c31bb8a

60 files changed

Lines changed: 901 additions & 1639 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/accessors.cc

Lines changed: 0 additions & 329 deletions
Original file line numberDiff line numberDiff line change
@@ -305,335 +305,6 @@ Handle<AccessorInfo> Accessors::MakeStringLengthInfo(Isolate* isolate) {
305305
&StringLengthGetter, nullptr);
306306
}
307307

308-
//
309-
// Accessors::ScriptColumnOffset
310-
//
311-
312-
313-
void Accessors::ScriptColumnOffsetGetter(
314-
v8::Local<v8::Name> name,
315-
const v8::PropertyCallbackInfo<v8::Value>& info) {
316-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
317-
DisallowHeapAllocation no_allocation;
318-
HandleScope scope(isolate);
319-
Object* object = *Utils::OpenHandle(*info.Holder());
320-
Object* res = Smi::FromInt(
321-
Script::cast(JSValue::cast(object)->value())->column_offset());
322-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
323-
}
324-
325-
Handle<AccessorInfo> Accessors::MakeScriptColumnOffsetInfo(Isolate* isolate) {
326-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
327-
STATIC_CHAR_VECTOR("column_offset")));
328-
return MakeAccessor(isolate, name, &ScriptColumnOffsetGetter, nullptr);
329-
}
330-
331-
332-
//
333-
// Accessors::ScriptId
334-
//
335-
336-
337-
void Accessors::ScriptIdGetter(
338-
v8::Local<v8::Name> name,
339-
const v8::PropertyCallbackInfo<v8::Value>& info) {
340-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
341-
DisallowHeapAllocation no_allocation;
342-
HandleScope scope(isolate);
343-
Object* object = *Utils::OpenHandle(*info.Holder());
344-
Object* id = Smi::FromInt(Script::cast(JSValue::cast(object)->value())->id());
345-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(id, isolate)));
346-
}
347-
348-
Handle<AccessorInfo> Accessors::MakeScriptIdInfo(Isolate* isolate) {
349-
Handle<String> name(
350-
isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("id")));
351-
return MakeAccessor(isolate, name, &ScriptIdGetter, nullptr);
352-
}
353-
354-
355-
//
356-
// Accessors::ScriptName
357-
//
358-
359-
360-
void Accessors::ScriptNameGetter(
361-
v8::Local<v8::Name> name,
362-
const v8::PropertyCallbackInfo<v8::Value>& info) {
363-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
364-
DisallowHeapAllocation no_allocation;
365-
HandleScope scope(isolate);
366-
Object* object = *Utils::OpenHandle(*info.Holder());
367-
Object* source = Script::cast(JSValue::cast(object)->value())->name();
368-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(source, isolate)));
369-
}
370-
371-
Handle<AccessorInfo> Accessors::MakeScriptNameInfo(Isolate* isolate) {
372-
return MakeAccessor(isolate, isolate->factory()->name_string(),
373-
&ScriptNameGetter, nullptr);
374-
}
375-
376-
377-
//
378-
// Accessors::ScriptSource
379-
//
380-
381-
382-
void Accessors::ScriptSourceGetter(
383-
v8::Local<v8::Name> name,
384-
const v8::PropertyCallbackInfo<v8::Value>& info) {
385-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
386-
DisallowHeapAllocation no_allocation;
387-
HandleScope scope(isolate);
388-
Object* object = *Utils::OpenHandle(*info.Holder());
389-
Object* source = Script::cast(JSValue::cast(object)->value())->source();
390-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(source, isolate)));
391-
}
392-
393-
Handle<AccessorInfo> Accessors::MakeScriptSourceInfo(Isolate* isolate) {
394-
return MakeAccessor(isolate, isolate->factory()->source_string(),
395-
&ScriptSourceGetter, nullptr);
396-
}
397-
398-
399-
//
400-
// Accessors::ScriptLineOffset
401-
//
402-
403-
404-
void Accessors::ScriptLineOffsetGetter(
405-
v8::Local<v8::Name> name,
406-
const v8::PropertyCallbackInfo<v8::Value>& info) {
407-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
408-
DisallowHeapAllocation no_allocation;
409-
HandleScope scope(isolate);
410-
Object* object = *Utils::OpenHandle(*info.Holder());
411-
Object* res =
412-
Smi::FromInt(Script::cast(JSValue::cast(object)->value())->line_offset());
413-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
414-
}
415-
416-
Handle<AccessorInfo> Accessors::MakeScriptLineOffsetInfo(Isolate* isolate) {
417-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
418-
STATIC_CHAR_VECTOR("line_offset")));
419-
return MakeAccessor(isolate, name, &ScriptLineOffsetGetter, nullptr);
420-
}
421-
422-
423-
//
424-
// Accessors::ScriptType
425-
//
426-
427-
428-
void Accessors::ScriptTypeGetter(
429-
v8::Local<v8::Name> name,
430-
const v8::PropertyCallbackInfo<v8::Value>& info) {
431-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
432-
DisallowHeapAllocation no_allocation;
433-
HandleScope scope(isolate);
434-
Object* object = *Utils::OpenHandle(*info.Holder());
435-
Object* res =
436-
Smi::FromInt(Script::cast(JSValue::cast(object)->value())->type());
437-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
438-
}
439-
440-
Handle<AccessorInfo> Accessors::MakeScriptTypeInfo(Isolate* isolate) {
441-
Handle<String> name(
442-
isolate->factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("type")));
443-
return MakeAccessor(isolate, name, &ScriptTypeGetter, nullptr);
444-
}
445-
446-
447-
//
448-
// Accessors::ScriptCompilationType
449-
//
450-
451-
452-
void Accessors::ScriptCompilationTypeGetter(
453-
v8::Local<v8::Name> name,
454-
const v8::PropertyCallbackInfo<v8::Value>& info) {
455-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
456-
DisallowHeapAllocation no_allocation;
457-
HandleScope scope(isolate);
458-
Object* object = *Utils::OpenHandle(*info.Holder());
459-
Object* res = Smi::FromInt(
460-
Script::cast(JSValue::cast(object)->value())->compilation_type());
461-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
462-
}
463-
464-
Handle<AccessorInfo> Accessors::MakeScriptCompilationTypeInfo(
465-
Isolate* isolate) {
466-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
467-
STATIC_CHAR_VECTOR("compilation_type")));
468-
return MakeAccessor(isolate, name, &ScriptCompilationTypeGetter, nullptr);
469-
}
470-
471-
472-
//
473-
// Accessors::ScriptSourceUrl
474-
//
475-
476-
477-
void Accessors::ScriptSourceUrlGetter(
478-
v8::Local<v8::Name> name,
479-
const v8::PropertyCallbackInfo<v8::Value>& info) {
480-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
481-
DisallowHeapAllocation no_allocation;
482-
HandleScope scope(isolate);
483-
Object* object = *Utils::OpenHandle(*info.Holder());
484-
Object* url = Script::cast(JSValue::cast(object)->value())->source_url();
485-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate)));
486-
}
487-
488-
Handle<AccessorInfo> Accessors::MakeScriptSourceUrlInfo(Isolate* isolate) {
489-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
490-
STATIC_CHAR_VECTOR("source_url")));
491-
return MakeAccessor(isolate, name, &ScriptSourceUrlGetter, nullptr);
492-
}
493-
494-
495-
//
496-
// Accessors::ScriptSourceMappingUrl
497-
//
498-
499-
500-
void Accessors::ScriptSourceMappingUrlGetter(
501-
v8::Local<v8::Name> name,
502-
const v8::PropertyCallbackInfo<v8::Value>& info) {
503-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
504-
DisallowHeapAllocation no_allocation;
505-
HandleScope scope(isolate);
506-
Object* object = *Utils::OpenHandle(*info.Holder());
507-
Object* url =
508-
Script::cast(JSValue::cast(object)->value())->source_mapping_url();
509-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(url, isolate)));
510-
}
511-
512-
Handle<AccessorInfo> Accessors::MakeScriptSourceMappingUrlInfo(
513-
Isolate* isolate) {
514-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
515-
STATIC_CHAR_VECTOR("source_mapping_url")));
516-
return MakeAccessor(isolate, name, &ScriptSourceMappingUrlGetter, nullptr);
517-
}
518-
519-
520-
//
521-
// Accessors::ScriptGetContextData
522-
//
523-
524-
525-
void Accessors::ScriptContextDataGetter(
526-
v8::Local<v8::Name> name,
527-
const v8::PropertyCallbackInfo<v8::Value>& info) {
528-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
529-
DisallowHeapAllocation no_allocation;
530-
HandleScope scope(isolate);
531-
Object* object = *Utils::OpenHandle(*info.Holder());
532-
Object* res = Script::cast(JSValue::cast(object)->value())->context_data();
533-
info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate)));
534-
}
535-
536-
Handle<AccessorInfo> Accessors::MakeScriptContextDataInfo(Isolate* isolate) {
537-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
538-
STATIC_CHAR_VECTOR("context_data")));
539-
return MakeAccessor(isolate, name, &ScriptContextDataGetter, nullptr);
540-
}
541-
542-
543-
//
544-
// Accessors::ScriptGetEvalFromScript
545-
//
546-
547-
548-
void Accessors::ScriptEvalFromScriptGetter(
549-
v8::Local<v8::Name> name,
550-
const v8::PropertyCallbackInfo<v8::Value>& info) {
551-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
552-
HandleScope scope(isolate);
553-
Handle<Object> object = Utils::OpenHandle(*info.Holder());
554-
Handle<Script> script(
555-
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
556-
Handle<Object> result = isolate->factory()->undefined_value();
557-
if (script->has_eval_from_shared()) {
558-
Handle<SharedFunctionInfo> eval_from_shared(script->eval_from_shared(),
559-
isolate);
560-
if (eval_from_shared->script()->IsScript()) {
561-
Handle<Script> eval_from_script(Script::cast(eval_from_shared->script()),
562-
isolate);
563-
result = Script::GetWrapper(eval_from_script);
564-
}
565-
}
566-
567-
info.GetReturnValue().Set(Utils::ToLocal(result));
568-
}
569-
570-
Handle<AccessorInfo> Accessors::MakeScriptEvalFromScriptInfo(Isolate* isolate) {
571-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
572-
STATIC_CHAR_VECTOR("eval_from_script")));
573-
return MakeAccessor(isolate, name, &ScriptEvalFromScriptGetter, nullptr);
574-
}
575-
576-
577-
//
578-
// Accessors::ScriptGetEvalFromScriptPosition
579-
//
580-
581-
582-
void Accessors::ScriptEvalFromScriptPositionGetter(
583-
v8::Local<v8::Name> name,
584-
const v8::PropertyCallbackInfo<v8::Value>& info) {
585-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
586-
HandleScope scope(isolate);
587-
Handle<Object> object = Utils::OpenHandle(*info.Holder());
588-
Handle<Script> script(
589-
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
590-
Handle<Object> result = isolate->factory()->undefined_value();
591-
if (script->compilation_type() == Script::COMPILATION_TYPE_EVAL) {
592-
result = Handle<Object>(Smi::FromInt(script->GetEvalPosition()), isolate);
593-
}
594-
info.GetReturnValue().Set(Utils::ToLocal(result));
595-
}
596-
597-
Handle<AccessorInfo> Accessors::MakeScriptEvalFromScriptPositionInfo(
598-
Isolate* isolate) {
599-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
600-
STATIC_CHAR_VECTOR("eval_from_script_position")));
601-
return MakeAccessor(isolate, name, &ScriptEvalFromScriptPositionGetter,
602-
nullptr);
603-
}
604-
605-
606-
//
607-
// Accessors::ScriptGetEvalFromFunctionName
608-
//
609-
610-
611-
void Accessors::ScriptEvalFromFunctionNameGetter(
612-
v8::Local<v8::Name> name,
613-
const v8::PropertyCallbackInfo<v8::Value>& info) {
614-
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate());
615-
HandleScope scope(isolate);
616-
Handle<Object> object = Utils::OpenHandle(*info.Holder());
617-
Handle<Script> script(
618-
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
619-
Handle<Object> result = isolate->factory()->undefined_value();
620-
if (script->has_eval_from_shared()) {
621-
Handle<SharedFunctionInfo> shared(script->eval_from_shared(), isolate);
622-
// Find the name of the function calling eval.
623-
result = Handle<Object>(shared->Name(), isolate);
624-
}
625-
info.GetReturnValue().Set(Utils::ToLocal(result));
626-
}
627-
628-
Handle<AccessorInfo> Accessors::MakeScriptEvalFromFunctionNameInfo(
629-
Isolate* isolate) {
630-
Handle<String> name(isolate->factory()->InternalizeOneByteString(
631-
STATIC_CHAR_VECTOR("eval_from_function_name")));
632-
return MakeAccessor(isolate, name, &ScriptEvalFromFunctionNameGetter,
633-
nullptr);
634-
}
635-
636-
637308
//
638309
// Accessors::FunctionPrototype
639310
//

src/accessors.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,6 @@ class JavaScriptFrame;
3333
V(function_name, FunctionName) \
3434
V(function_length, FunctionLength) \
3535
V(function_prototype, FunctionPrototype) \
36-
V(script_column_offset, ScriptColumnOffset) \
37-
V(script_compilation_type, ScriptCompilationType) \
38-
V(script_context_data, ScriptContextData) \
39-
V(script_eval_from_script, ScriptEvalFromScript) \
40-
V(script_eval_from_script_position, ScriptEvalFromScriptPosition) \
41-
V(script_eval_from_function_name, ScriptEvalFromFunctionName) \
42-
V(script_id, ScriptId) \
43-
V(script_line_offset, ScriptLineOffset) \
44-
V(script_name, ScriptName) \
45-
V(script_source, ScriptSource) \
46-
V(script_type, ScriptType) \
47-
V(script_source_url, ScriptSourceUrl) \
48-
V(script_source_mapping_url, ScriptSourceMappingUrl) \
4936
V(string_length, StringLength)
5037

5138
#define SIDE_EFFECT_FREE_ACCESSOR_INFO_LIST(V) \

src/api.cc

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,9 +2930,7 @@ ScriptOrigin Message::GetScriptOrigin() const {
29302930
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
29312931
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
29322932
auto message = i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
2933-
auto script_wraper = i::Handle<i::Object>(message->script(), isolate);
2934-
auto script_value = i::Handle<i::JSValue>::cast(script_wraper);
2935-
i::Handle<i::Script> script(i::Script::cast(script_value->value()), isolate);
2933+
i::Handle<i::Script> script(message->script(), isolate);
29362934
return GetScriptOriginForScript(isolate, script);
29372935
}
29382936

@@ -3020,21 +3018,16 @@ Maybe<int> Message::GetEndColumn(Local<Context> context) const {
30203018
bool Message::IsSharedCrossOrigin() const {
30213019
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
30223020
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
3023-
auto self = Utils::OpenHandle(this);
3024-
auto script = i::Handle<i::JSValue>::cast(
3025-
i::Handle<i::Object>(self->script(), isolate));
3026-
return i::Script::cast(script->value())
3021+
return Utils::OpenHandle(this)
3022+
->script()
30273023
->origin_options()
30283024
.IsSharedCrossOrigin();
30293025
}
30303026

30313027
bool Message::IsOpaque() const {
30323028
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
30333029
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(isolate);
3034-
auto self = Utils::OpenHandle(this);
3035-
auto script = i::Handle<i::JSValue>::cast(
3036-
i::Handle<i::Object>(self->script(), isolate));
3037-
return i::Script::cast(script->value())->origin_options().IsOpaque();
3030+
return Utils::OpenHandle(this)->script()->origin_options().IsOpaque();
30383031
}
30393032

30403033

0 commit comments

Comments
 (0)