Chromium Code Reviews| Index: src/api.cc |
| diff --git a/src/api.cc b/src/api.cc |
| index 6c04687df5be900adf8f559778848fca0052d2b1..bc4fed2acd2722ddfba5ef2cd6219b6d1717e186 100644 |
| --- a/src/api.cc |
| +++ b/src/api.cc |
| @@ -2879,6 +2879,33 @@ Local<v8::Object> v8::Object::Clone() { |
| } |
| +static i::Context* creationContext(i::JSObject* object) { |
|
Mads Ager (chromium)
2011/04/01 11:19:38
Use Google naming convention please: CreationConte
antonm
2011/04/01 12:15:46
Done.
|
| + i::Object* constructor = object->map()->constructor(); |
| + i::JSFunction* function; |
| + if (!constructor->IsJSFunction()) { |
| + // API functions have null as a constructor, |
| + // but any JSFunction knows its context immediately. |
| + ASSERT(object->IsJSFunction() && |
| + i::JSFunction::cast(object)->shared()->IsApiFunction()); |
| + function = i::JSFunction::cast(object); |
| + } else { |
| + function = i::JSFunction::cast(constructor); |
| + } |
| + return function->context()->global_context(); |
| +} |
| + |
| + |
| +Local<v8::Context> v8::Object::CreationContext() { |
| + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| + ON_BAILOUT(isolate, |
| + "v8::Object::CreationContext()", return Local<v8::Context>()); |
| + ENTER_V8(isolate); |
| + i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
| + i::Context* context = creationContext(*self); |
| + return Utils::ToLocal(i::Handle<i::Context>(context)); |
| +} |
| + |
| + |
| int v8::Object::GetIdentityHash() { |
| i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| ON_BAILOUT(isolate, "v8::Object::GetIdentityHash()", return 0); |