OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2872 ENTER_V8(isolate); | 2872 ENTER_V8(isolate); |
2873 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2873 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2874 EXCEPTION_PREAMBLE(isolate); | 2874 EXCEPTION_PREAMBLE(isolate); |
2875 i::Handle<i::JSObject> result = i::Copy(self); | 2875 i::Handle<i::JSObject> result = i::Copy(self); |
2876 has_pending_exception = result.is_null(); | 2876 has_pending_exception = result.is_null(); |
2877 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); | 2877 EXCEPTION_BAILOUT_CHECK(isolate, Local<Object>()); |
2878 return Utils::ToLocal(result); | 2878 return Utils::ToLocal(result); |
2879 } | 2879 } |
2880 | 2880 |
2881 | 2881 |
| 2882 static i::Context* GetCreationContext(i::JSObject* object) { |
| 2883 i::Object* constructor = object->map()->constructor(); |
| 2884 i::JSFunction* function; |
| 2885 if (!constructor->IsJSFunction()) { |
| 2886 // API functions have null as a constructor, |
| 2887 // but any JSFunction knows its context immediately. |
| 2888 ASSERT(object->IsJSFunction() && |
| 2889 i::JSFunction::cast(object)->shared()->IsApiFunction()); |
| 2890 function = i::JSFunction::cast(object); |
| 2891 } else { |
| 2892 function = i::JSFunction::cast(constructor); |
| 2893 } |
| 2894 return function->context()->global_context(); |
| 2895 } |
| 2896 |
| 2897 |
| 2898 Local<v8::Context> v8::Object::CreationContext() { |
| 2899 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 2900 ON_BAILOUT(isolate, |
| 2901 "v8::Object::CreationContext()", return Local<v8::Context>()); |
| 2902 ENTER_V8(isolate); |
| 2903 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| 2904 i::Context* context = GetCreationContext(*self); |
| 2905 return Utils::ToLocal(i::Handle<i::Context>(context)); |
| 2906 } |
| 2907 |
| 2908 |
2882 int v8::Object::GetIdentityHash() { | 2909 int v8::Object::GetIdentityHash() { |
2883 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 2910 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
2884 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); | 2911 ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); |
2885 ENTER_V8(isolate); | 2912 ENTER_V8(isolate); |
2886 i::HandleScope scope(isolate); | 2913 i::HandleScope scope(isolate); |
2887 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2914 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2888 i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true)); | 2915 i::Handle<i::Object> hidden_props_obj(i::GetHiddenProperties(self, true)); |
2889 if (!hidden_props_obj->IsJSObject()) { | 2916 if (!hidden_props_obj->IsJSObject()) { |
2890 // We failed to create hidden properties. That's a detached | 2917 // We failed to create hidden properties. That's a detached |
2891 // global proxy. | 2918 // global proxy. |
(...skipping 2750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5642 | 5669 |
5643 | 5670 |
5644 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5671 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5645 HandleScopeImplementer* scope_implementer = | 5672 HandleScopeImplementer* scope_implementer = |
5646 reinterpret_cast<HandleScopeImplementer*>(storage); | 5673 reinterpret_cast<HandleScopeImplementer*>(storage); |
5647 scope_implementer->IterateThis(v); | 5674 scope_implementer->IterateThis(v); |
5648 return storage + ArchiveSpacePerThread(); | 5675 return storage + ArchiveSpacePerThread(); |
5649 } | 5676 } |
5650 | 5677 |
5651 } } // namespace v8::internal | 5678 } } // namespace v8::internal |
OLD | NEW |