OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 | 1257 |
1258 | 1258 |
1259 int TypeSwitch::match(v8::Handle<Value> value) { | 1259 int TypeSwitch::match(v8::Handle<Value> value) { |
1260 i::Isolate* isolate = i::Isolate::Current(); | 1260 i::Isolate* isolate = i::Isolate::Current(); |
1261 LOG_API(isolate, "TypeSwitch::match"); | 1261 LOG_API(isolate, "TypeSwitch::match"); |
1262 USE(isolate); | 1262 USE(isolate); |
1263 i::Handle<i::Object> obj = Utils::OpenHandle(*value); | 1263 i::Handle<i::Object> obj = Utils::OpenHandle(*value); |
1264 i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this); | 1264 i::Handle<i::TypeSwitchInfo> info = Utils::OpenHandle(this); |
1265 i::FixedArray* types = i::FixedArray::cast(info->types()); | 1265 i::FixedArray* types = i::FixedArray::cast(info->types()); |
1266 for (int i = 0; i < types->length(); i++) { | 1266 for (int i = 0; i < types->length(); i++) { |
1267 if (obj->IsInstanceOf(i::FunctionTemplateInfo::cast(types->get(i)))) | 1267 if (i::FunctionTemplateInfo::cast(types->get(i))->IsTemplateFor(*obj)) |
1268 return i + 1; | 1268 return i + 1; |
1269 } | 1269 } |
1270 return 0; | 1270 return 0; |
1271 } | 1271 } |
1272 | 1272 |
1273 | 1273 |
1274 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ | 1274 #define SET_FIELD_WRAPPED(obj, setter, cdata) do { \ |
1275 i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \ | 1275 i::Handle<i::Object> foreign = FromCData(obj->GetIsolate(), cdata); \ |
1276 (obj)->setter(*foreign); \ | 1276 (obj)->setter(*foreign); \ |
1277 } while (false) | 1277 } while (false) |
(...skipping 2061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3339 | 3339 |
3340 Local<Object> v8::Object::FindInstanceInPrototypeChain( | 3340 Local<Object> v8::Object::FindInstanceInPrototypeChain( |
3341 v8::Handle<FunctionTemplate> tmpl) { | 3341 v8::Handle<FunctionTemplate> tmpl) { |
3342 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3342 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3343 ON_BAILOUT(isolate, | 3343 ON_BAILOUT(isolate, |
3344 "v8::Object::FindInstanceInPrototypeChain()", | 3344 "v8::Object::FindInstanceInPrototypeChain()", |
3345 return Local<v8::Object>()); | 3345 return Local<v8::Object>()); |
3346 ENTER_V8(isolate); | 3346 ENTER_V8(isolate); |
3347 i::JSObject* object = *Utils::OpenHandle(this); | 3347 i::JSObject* object = *Utils::OpenHandle(this); |
3348 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl); | 3348 i::FunctionTemplateInfo* tmpl_info = *Utils::OpenHandle(*tmpl); |
3349 while (!object->IsInstanceOf(tmpl_info)) { | 3349 while (!tmpl_info->IsTemplateFor(object)) { |
3350 i::Object* prototype = object->GetPrototype(); | 3350 i::Object* prototype = object->GetPrototype(); |
3351 if (!prototype->IsJSObject()) return Local<Object>(); | 3351 if (!prototype->IsJSObject()) return Local<Object>(); |
3352 object = i::JSObject::cast(prototype); | 3352 object = i::JSObject::cast(prototype); |
3353 } | 3353 } |
3354 return Utils::ToLocal(i::Handle<i::JSObject>(object)); | 3354 return Utils::ToLocal(i::Handle<i::JSObject>(object)); |
3355 } | 3355 } |
3356 | 3356 |
3357 | 3357 |
3358 Local<Array> v8::Object::GetPropertyNames() { | 3358 Local<Array> v8::Object::GetPropertyNames() { |
3359 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3359 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5420 &has_pending_exception); | 5420 &has_pending_exception); |
5421 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>()); | 5421 EXCEPTION_BAILOUT_CHECK(isolate, Local<v8::Function>()); |
5422 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); | 5422 return Utils::ToLocal(i::Handle<i::JSFunction>::cast(obj)); |
5423 } | 5423 } |
5424 | 5424 |
5425 | 5425 |
5426 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { | 5426 bool FunctionTemplate::HasInstance(v8::Handle<v8::Value> value) { |
5427 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", | 5427 ON_BAILOUT(i::Isolate::Current(), "v8::FunctionTemplate::HasInstanceOf()", |
5428 return false); | 5428 return false); |
5429 i::Object* obj = *Utils::OpenHandle(*value); | 5429 i::Object* obj = *Utils::OpenHandle(*value); |
5430 return obj->IsInstanceOf(*Utils::OpenHandle(this)); | 5430 return Utils::OpenHandle(this)->IsTemplateFor(obj); |
5431 } | 5431 } |
5432 | 5432 |
5433 | 5433 |
5434 Local<External> v8::External::New(Isolate* isolate, void* value) { | 5434 Local<External> v8::External::New(Isolate* isolate, void* value) { |
5435 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); | 5435 STATIC_ASSERT(sizeof(value) == sizeof(i::Address)); |
5436 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); | 5436 i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); |
5437 EnsureInitializedForIsolate(i_isolate, "v8::External::New()"); | 5437 EnsureInitializedForIsolate(i_isolate, "v8::External::New()"); |
5438 LOG_API(i_isolate, "External::New"); | 5438 LOG_API(i_isolate, "External::New"); |
5439 ENTER_V8(i_isolate); | 5439 ENTER_V8(i_isolate); |
5440 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); | 5440 i::Handle<i::JSObject> external = i_isolate->factory()->NewExternal(value); |
(...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7657 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7657 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7658 Address callback_address = | 7658 Address callback_address = |
7659 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7659 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7660 VMState<EXTERNAL> state(isolate); | 7660 VMState<EXTERNAL> state(isolate); |
7661 ExternalCallbackScope call_scope(isolate, callback_address); | 7661 ExternalCallbackScope call_scope(isolate, callback_address); |
7662 callback(info); | 7662 callback(info); |
7663 } | 7663 } |
7664 | 7664 |
7665 | 7665 |
7666 } } // namespace v8::internal | 7666 } } // namespace v8::internal |
OLD | NEW |