OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 4281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4292 i::Object* obj = *Utils::OpenHandle(*value); | 4292 i::Object* obj = *Utils::OpenHandle(*value); |
4293 return obj->IsInstanceOf(*Utils::OpenHandle(this)); | 4293 return obj->IsInstanceOf(*Utils::OpenHandle(this)); |
4294 } | 4294 } |
4295 | 4295 |
4296 | 4296 |
4297 static Local<External> ExternalNewImpl(void* data) { | 4297 static Local<External> ExternalNewImpl(void* data) { |
4298 return Utils::ToLocal(FACTORY->NewForeign(static_cast<i::Address>(data))); | 4298 return Utils::ToLocal(FACTORY->NewForeign(static_cast<i::Address>(data))); |
4299 } | 4299 } |
4300 | 4300 |
4301 static void* ExternalValueImpl(i::Handle<i::Object> obj) { | 4301 static void* ExternalValueImpl(i::Handle<i::Object> obj) { |
4302 return reinterpret_cast<void*>(i::Foreign::cast(*obj)->address()); | 4302 return reinterpret_cast<void*>(i::Foreign::cast(*obj)->foreign_address()); |
4303 } | 4303 } |
4304 | 4304 |
4305 | 4305 |
4306 Local<Value> v8::External::Wrap(void* data) { | 4306 Local<Value> v8::External::Wrap(void* data) { |
4307 i::Isolate* isolate = i::Isolate::Current(); | 4307 i::Isolate* isolate = i::Isolate::Current(); |
4308 STATIC_ASSERT(sizeof(data) == sizeof(i::Address)); | 4308 STATIC_ASSERT(sizeof(data) == sizeof(i::Address)); |
4309 EnsureInitializedForIsolate(isolate, "v8::External::Wrap()"); | 4309 EnsureInitializedForIsolate(isolate, "v8::External::Wrap()"); |
4310 LOG_API(isolate, "External::Wrap"); | 4310 LOG_API(isolate, "External::Wrap"); |
4311 ENTER_V8(isolate); | 4311 ENTER_V8(isolate); |
4312 | 4312 |
4313 v8::Local<v8::Value> result = CanBeEncodedAsSmi(data) | 4313 v8::Local<v8::Value> result = CanBeEncodedAsSmi(data) |
4314 ? Utils::ToLocal(i::Handle<i::Object>(EncodeAsSmi(data))) | 4314 ? Utils::ToLocal(i::Handle<i::Object>(EncodeAsSmi(data))) |
4315 : v8::Local<v8::Value>(ExternalNewImpl(data)); | 4315 : v8::Local<v8::Value>(ExternalNewImpl(data)); |
4316 | 4316 |
4317 ASSERT_EQ(data, Unwrap(result)); | 4317 ASSERT_EQ(data, Unwrap(result)); |
4318 return result; | 4318 return result; |
4319 } | 4319 } |
4320 | 4320 |
4321 | 4321 |
4322 void* v8::Object::SlowGetPointerFromInternalField(int index) { | 4322 void* v8::Object::SlowGetPointerFromInternalField(int index) { |
4323 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); | 4323 i::Handle<i::JSObject> obj = Utils::OpenHandle(this); |
4324 i::Object* value = obj->GetInternalField(index); | 4324 i::Object* value = obj->GetInternalField(index); |
4325 if (value->IsSmi()) { | 4325 if (value->IsSmi()) { |
4326 return i::Internals::GetExternalPointerFromSmi(value); | 4326 return i::Internals::GetExternalPointerFromSmi(value); |
4327 } else if (value->IsForeign()) { | 4327 } else if (value->IsForeign()) { |
4328 return reinterpret_cast<void*>(i::Foreign::cast(value)->address()); | 4328 return reinterpret_cast<void*>(i::Foreign::cast(value)->foreign_address()); |
4329 } else { | 4329 } else { |
4330 return NULL; | 4330 return NULL; |
4331 } | 4331 } |
4332 } | 4332 } |
4333 | 4333 |
4334 | 4334 |
4335 void* v8::External::FullUnwrap(v8::Handle<v8::Value> wrapper) { | 4335 void* v8::External::FullUnwrap(v8::Handle<v8::Value> wrapper) { |
4336 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Unwrap()")) return 0; | 4336 if (IsDeadCheck(i::Isolate::Current(), "v8::External::Unwrap()")) return 0; |
4337 i::Handle<i::Object> obj = Utils::OpenHandle(*wrapper); | 4337 i::Handle<i::Object> obj = Utils::OpenHandle(*wrapper); |
4338 void* result; | 4338 void* result; |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4871 EnsureInitializedForIsolate(isolate, "v8::V8::RemoveMessageListener()"); | 4871 EnsureInitializedForIsolate(isolate, "v8::V8::RemoveMessageListener()"); |
4872 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return); | 4872 ON_BAILOUT(isolate, "v8::V8::RemoveMessageListeners()", return); |
4873 ENTER_V8(isolate); | 4873 ENTER_V8(isolate); |
4874 i::HandleScope scope(isolate); | 4874 i::HandleScope scope(isolate); |
4875 NeanderArray listeners(isolate->factory()->message_listeners()); | 4875 NeanderArray listeners(isolate->factory()->message_listeners()); |
4876 for (int i = 0; i < listeners.length(); i++) { | 4876 for (int i = 0; i < listeners.length(); i++) { |
4877 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones | 4877 if (listeners.get(i)->IsUndefined()) continue; // skip deleted ones |
4878 | 4878 |
4879 NeanderObject listener(i::JSObject::cast(listeners.get(i))); | 4879 NeanderObject listener(i::JSObject::cast(listeners.get(i))); |
4880 i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listener.get(0))); | 4880 i::Handle<i::Foreign> callback_obj(i::Foreign::cast(listener.get(0))); |
4881 if (callback_obj->address() == FUNCTION_ADDR(that)) { | 4881 if (callback_obj->foreign_address() == FUNCTION_ADDR(that)) { |
4882 listeners.set(i, isolate->heap()->undefined_value()); | 4882 listeners.set(i, isolate->heap()->undefined_value()); |
4883 } | 4883 } |
4884 } | 4884 } |
4885 } | 4885 } |
4886 | 4886 |
4887 | 4887 |
4888 void V8::SetCaptureStackTraceForUncaughtExceptions( | 4888 void V8::SetCaptureStackTraceForUncaughtExceptions( |
4889 bool capture, | 4889 bool capture, |
4890 int frame_limit, | 4890 int frame_limit, |
4891 StackTrace::StackTraceOptions options) { | 4891 StackTrace::StackTraceOptions options) { |
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6100 | 6100 |
6101 | 6101 |
6102 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 6102 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
6103 HandleScopeImplementer* scope_implementer = | 6103 HandleScopeImplementer* scope_implementer = |
6104 reinterpret_cast<HandleScopeImplementer*>(storage); | 6104 reinterpret_cast<HandleScopeImplementer*>(storage); |
6105 scope_implementer->IterateThis(v); | 6105 scope_implementer->IterateThis(v); |
6106 return storage + ArchiveSpacePerThread(); | 6106 return storage + ArchiveSpacePerThread(); |
6107 } | 6107 } |
6108 | 6108 |
6109 } } // namespace v8::internal | 6109 } } // namespace v8::internal |
OLD | NEW |