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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 Isolate* isolate, PropertyAttributes attributes) { | 780 Isolate* isolate, PropertyAttributes attributes) { |
781 return MakeAccessor(isolate, | 781 return MakeAccessor(isolate, |
782 isolate->factory()->source_mapping_url_string(), | 782 isolate->factory()->source_mapping_url_string(), |
783 &ScriptSourceMappingUrlGetter, | 783 &ScriptSourceMappingUrlGetter, |
784 &ScriptSourceMappingUrlSetter, | 784 &ScriptSourceMappingUrlSetter, |
785 attributes); | 785 attributes); |
786 } | 786 } |
787 | 787 |
788 | 788 |
789 // | 789 // |
790 // Accessors::ScriptIsDebuggerScript | |
791 // | |
792 | |
793 | |
794 void Accessors::ScriptIsDebuggerScriptGetter( | |
Yang
2015/01/28 09:47:30
Why is this necessary? I don't see it for the is_s
kozy
2015/01/29 10:52:55
We use this variable in our DebuggerScript.js in b
| |
795 v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { | |
796 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | |
797 DisallowHeapAllocation no_allocation; | |
798 HandleScope scope(isolate); | |
799 Object* object = *Utils::OpenHandle(*info.This()); | |
800 bool is_debugger_script = | |
801 Script::cast(JSValue::cast(object)->value())->is_debugger_script(); | |
802 Object* res = *isolate->factory()->ToBoolean(is_debugger_script); | |
803 info.GetReturnValue().Set(Utils::ToLocal(Handle<Object>(res, isolate))); | |
804 } | |
805 | |
806 | |
807 void Accessors::ScriptIsDebuggerScriptSetter( | |
808 v8::Local<v8::Name> name, v8::Local<v8::Value> value, | |
809 const v8::PropertyCallbackInfo<void>& info) { | |
810 UNREACHABLE(); | |
811 } | |
812 | |
813 | |
814 Handle<AccessorInfo> Accessors::ScriptIsDebuggerScriptInfo( | |
815 Isolate* isolate, PropertyAttributes attributes) { | |
816 Handle<String> name(isolate->factory()->InternalizeOneByteString( | |
817 STATIC_CHAR_VECTOR("is_debugger_script"))); | |
818 return MakeAccessor(isolate, name, &ScriptIsDebuggerScriptGetter, | |
819 &ScriptIsDebuggerScriptSetter, attributes); | |
820 } | |
821 | |
822 | |
823 // | |
790 // Accessors::ScriptGetContextData | 824 // Accessors::ScriptGetContextData |
791 // | 825 // |
792 | 826 |
793 | 827 |
794 void Accessors::ScriptContextDataGetter( | 828 void Accessors::ScriptContextDataGetter( |
795 v8::Local<v8::Name> name, | 829 v8::Local<v8::Name> name, |
796 const v8::PropertyCallbackInfo<v8::Value>& info) { | 830 const v8::PropertyCallbackInfo<v8::Value>& info) { |
797 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); | 831 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(info.GetIsolate()); |
798 DisallowHeapAllocation no_allocation; | 832 DisallowHeapAllocation no_allocation; |
799 HandleScope scope(isolate); | 833 HandleScope scope(isolate); |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1494 info->set_data(Smi::FromInt(index)); | 1528 info->set_data(Smi::FromInt(index)); |
1495 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1529 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1496 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1530 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1497 info->set_getter(*getter); | 1531 info->set_getter(*getter); |
1498 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1532 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1499 return info; | 1533 return info; |
1500 } | 1534 } |
1501 | 1535 |
1502 | 1536 |
1503 } } // namespace v8::internal | 1537 } } // namespace v8::internal |
OLD | NEW |