OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/accessors.h" | 5 #include "src/accessors.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/execution.h" | 10 #include "src/execution.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 void Accessors::ScriptEvalFromScriptPositionGetter( | 654 void Accessors::ScriptEvalFromScriptPositionGetter( |
655 v8::Local<v8::Name> name, | 655 v8::Local<v8::Name> name, |
656 const v8::PropertyCallbackInfo<v8::Value>& info) { | 656 const v8::PropertyCallbackInfo<v8::Value>& info) { |
657 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 657 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
658 HandleScope scope(isolate); | 658 HandleScope scope(isolate); |
659 Handle<Object> object = Utils::OpenHandle(*info.This()); | 659 Handle<Object> object = Utils::OpenHandle(*info.This()); |
660 Handle<Script> script( | 660 Handle<Script> script( |
661 Script::cast(Handle<JSValue>::cast(object)->value()), isolate); | 661 Script::cast(Handle<JSValue>::cast(object)->value()), isolate); |
662 Handle<Object> result = isolate->factory()->undefined_value(); | 662 Handle<Object> result = isolate->factory()->undefined_value(); |
663 if (script->compilation_type() == Script::COMPILATION_TYPE_EVAL) { | 663 if (script->compilation_type() == Script::COMPILATION_TYPE_EVAL) { |
664 Handle<Code> code(SharedFunctionInfo::cast( | 664 result = |
665 script->eval_from_shared())->code()); | 665 Handle<Object>(Smi::FromInt(script->eval_from_position()), isolate); |
666 result = Handle<Object>(Smi::FromInt(code->SourcePosition( | |
667 script->eval_from_instructions_offset())), | |
668 isolate); | |
669 } | 666 } |
670 info.GetReturnValue().Set(Utils::ToLocal(result)); | 667 info.GetReturnValue().Set(Utils::ToLocal(result)); |
671 } | 668 } |
672 | 669 |
673 | 670 |
674 Handle<AccessorInfo> Accessors::ScriptEvalFromScriptPositionInfo( | 671 Handle<AccessorInfo> Accessors::ScriptEvalFromScriptPositionInfo( |
675 Isolate* isolate, PropertyAttributes attributes) { | 672 Isolate* isolate, PropertyAttributes attributes) { |
676 Handle<String> name(isolate->factory()->InternalizeOneByteString( | 673 Handle<String> name(isolate->factory()->InternalizeOneByteString( |
677 STATIC_CHAR_VECTOR("eval_from_script_position"))); | 674 STATIC_CHAR_VECTOR("eval_from_script_position"))); |
678 return MakeAccessor(isolate, name, &ScriptEvalFromScriptPositionGetter, | 675 return MakeAccessor(isolate, name, &ScriptEvalFromScriptPositionGetter, |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 Isolate* isolate = name->GetIsolate(); | 1248 Isolate* isolate = name->GetIsolate(); |
1252 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, | 1249 Handle<AccessorInfo> info = MakeAccessor(isolate, name, &ModuleGetExport, |
1253 &ModuleSetExport, attributes); | 1250 &ModuleSetExport, attributes); |
1254 info->set_data(Smi::FromInt(index)); | 1251 info->set_data(Smi::FromInt(index)); |
1255 return info; | 1252 return info; |
1256 } | 1253 } |
1257 | 1254 |
1258 | 1255 |
1259 } // namespace internal | 1256 } // namespace internal |
1260 } // namespace v8 | 1257 } // namespace v8 |
OLD | NEW |