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 "api.h" | 5 #include "api.h" |
6 | 6 |
7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
8 #include <cmath> // For isnan. | 8 #include <cmath> // For isnan. |
9 #include "../include/v8-debug.h" | 9 #include "../include/v8-debug.h" |
10 #include "../include/v8-profiler.h" | 10 #include "../include/v8-profiler.h" |
(...skipping 3493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3504 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( | 3504 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
3505 Handle<String> key) { | 3505 Handle<String> key) { |
3506 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3506 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3507 ON_BAILOUT(isolate, | 3507 ON_BAILOUT(isolate, |
3508 "v8::Object::GetRealNamedPropertyInPrototypeChain()", | 3508 "v8::Object::GetRealNamedPropertyInPrototypeChain()", |
3509 return Local<Value>()); | 3509 return Local<Value>()); |
3510 ENTER_V8(isolate); | 3510 ENTER_V8(isolate); |
3511 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 3511 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
3512 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3512 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
3513 i::LookupResult lookup(isolate); | 3513 i::LookupResult lookup(isolate); |
3514 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup); | 3514 self_obj->LookupRealNamedPropertyInPrototypes(key_obj, &lookup); |
3515 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup); | 3515 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup); |
3516 } | 3516 } |
3517 | 3517 |
3518 | 3518 |
3519 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { | 3519 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
3520 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3520 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3521 ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()", | 3521 ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()", |
3522 return Local<Value>()); | 3522 return Local<Value>()); |
3523 ENTER_V8(isolate); | 3523 ENTER_V8(isolate); |
3524 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 3524 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
3525 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 3525 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
3526 i::LookupResult lookup(isolate); | 3526 i::LookupResult lookup(isolate); |
3527 self_obj->LookupRealNamedProperty(*key_obj, &lookup); | 3527 self_obj->LookupRealNamedProperty(key_obj, &lookup); |
3528 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup); | 3528 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup); |
3529 } | 3529 } |
3530 | 3530 |
3531 | 3531 |
3532 // Turns on access checks by copying the map and setting the check flag. | 3532 // Turns on access checks by copying the map and setting the check flag. |
3533 // Because the object gets a new map, existing inline cache caching | 3533 // Because the object gets a new map, existing inline cache caching |
3534 // the old map of this object will fail. | 3534 // the old map of this object will fail. |
3535 void v8::Object::TurnOnAccessCheck() { | 3535 void v8::Object::TurnOnAccessCheck() { |
3536 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3536 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3537 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); | 3537 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3993 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3993 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
3994 ON_BAILOUT(isolate, "v8::Function::GetDisplayName()", | 3994 ON_BAILOUT(isolate, "v8::Function::GetDisplayName()", |
3995 return ToApiHandle<Primitive>( | 3995 return ToApiHandle<Primitive>( |
3996 isolate->factory()->undefined_value())); | 3996 isolate->factory()->undefined_value())); |
3997 ENTER_V8(isolate); | 3997 ENTER_V8(isolate); |
3998 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 3998 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
3999 i::Handle<i::String> property_name = | 3999 i::Handle<i::String> property_name = |
4000 isolate->factory()->InternalizeOneByteString( | 4000 isolate->factory()->InternalizeOneByteString( |
4001 STATIC_ASCII_VECTOR("displayName")); | 4001 STATIC_ASCII_VECTOR("displayName")); |
4002 i::LookupResult lookup(isolate); | 4002 i::LookupResult lookup(isolate); |
4003 func->LookupRealNamedProperty(*property_name, &lookup); | 4003 func->LookupRealNamedProperty(property_name, &lookup); |
4004 if (lookup.IsFound()) { | 4004 if (lookup.IsFound()) { |
4005 i::Object* value = lookup.GetLazyValue(); | 4005 i::Object* value = lookup.GetLazyValue(); |
4006 if (value && value->IsString()) { | 4006 if (value && value->IsString()) { |
4007 i::String* name = i::String::cast(value); | 4007 i::String* name = i::String::cast(value); |
4008 if (name->length() > 0) return Utils::ToLocal(i::Handle<i::String>(name)); | 4008 if (name->length() > 0) return Utils::ToLocal(i::Handle<i::String>(name)); |
4009 } | 4009 } |
4010 } | 4010 } |
4011 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); | 4011 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); |
4012 } | 4012 } |
4013 | 4013 |
(...skipping 3568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7582 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7582 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
7583 Address callback_address = | 7583 Address callback_address = |
7584 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7584 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
7585 VMState<EXTERNAL> state(isolate); | 7585 VMState<EXTERNAL> state(isolate); |
7586 ExternalCallbackScope call_scope(isolate, callback_address); | 7586 ExternalCallbackScope call_scope(isolate, callback_address); |
7587 callback(info); | 7587 callback(info); |
7588 } | 7588 } |
7589 | 7589 |
7590 | 7590 |
7591 } } // namespace v8::internal | 7591 } } // namespace v8::internal |
OLD | NEW |