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 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2384 i::Handle<i::Object> result = i::GetPrototype(self); | 2384 i::Handle<i::Object> result = i::GetPrototype(self); |
2385 return Utils::ToLocal(result); | 2385 return Utils::ToLocal(result); |
2386 } | 2386 } |
2387 | 2387 |
2388 | 2388 |
2389 bool v8::Object::SetPrototype(Handle<Value> value) { | 2389 bool v8::Object::SetPrototype(Handle<Value> value) { |
2390 ON_BAILOUT("v8::Object::SetPrototype()", return false); | 2390 ON_BAILOUT("v8::Object::SetPrototype()", return false); |
2391 ENTER_V8; | 2391 ENTER_V8; |
2392 i::Handle<i::JSObject> self = Utils::OpenHandle(this); | 2392 i::Handle<i::JSObject> self = Utils::OpenHandle(this); |
2393 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); | 2393 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); |
2394 // We do not allow exceptions thrown while setting the prototype | |
2395 // propagate outside. | |
Mads Ager (chromium)
2011/03/21 10:33:22
propagate -> to propagate?
antonm
2011/03/21 18:15:48
Done.
| |
2396 TryCatch try_catch; | |
2394 EXCEPTION_PREAMBLE(); | 2397 EXCEPTION_PREAMBLE(); |
2395 i::Handle<i::Object> result = i::SetPrototype(self, value_obj); | 2398 i::Handle<i::Object> result = i::SetPrototype(self, value_obj); |
2396 has_pending_exception = result.is_null(); | 2399 has_pending_exception = result.is_null(); |
2397 EXCEPTION_BAILOUT_CHECK(false); | 2400 EXCEPTION_BAILOUT_CHECK(false); |
2398 return true; | 2401 return true; |
2399 } | 2402 } |
2400 | 2403 |
2401 | 2404 |
2402 Local<Object> v8::Object::FindInstanceInPrototypeChain( | 2405 Local<Object> v8::Object::FindInstanceInPrototypeChain( |
2403 v8::Handle<FunctionTemplate> tmpl) { | 2406 v8::Handle<FunctionTemplate> tmpl) { |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2570 return Utils::OpenHandle(this)->HasNamedInterceptor(); | 2573 return Utils::OpenHandle(this)->HasNamedInterceptor(); |
2571 } | 2574 } |
2572 | 2575 |
2573 | 2576 |
2574 bool v8::Object::HasIndexedLookupInterceptor() { | 2577 bool v8::Object::HasIndexedLookupInterceptor() { |
2575 ON_BAILOUT("v8::Object::HasIndexedLookupInterceptor()", return false); | 2578 ON_BAILOUT("v8::Object::HasIndexedLookupInterceptor()", return false); |
2576 return Utils::OpenHandle(this)->HasIndexedInterceptor(); | 2579 return Utils::OpenHandle(this)->HasIndexedInterceptor(); |
2577 } | 2580 } |
2578 | 2581 |
2579 | 2582 |
2583 static Local<Value> GetPropertyByLookup(i::Handle<i::JSObject> receiver, | |
2584 i::Handle<i::String> name, | |
2585 i::LookupResult* lookup) { | |
2586 if (!lookup->IsProperty()) { | |
2587 // No real property was found. | |
2588 return Local<Value>(); | |
2589 } | |
2590 | |
2591 // If the property being looked up is a callback, it can throw | |
2592 // an exception. | |
2593 EXCEPTION_PREAMBLE(); | |
2594 i::Handle<i::Object> result = i::GetProperty(receiver, name, lookup); | |
2595 has_pending_exception = result.is_null(); | |
2596 EXCEPTION_BAILOUT_CHECK(Local<Value>()); | |
2597 | |
2598 return Utils::ToLocal(result); | |
2599 } | |
2600 | |
2601 | |
2580 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( | 2602 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( |
2581 Handle<String> key) { | 2603 Handle<String> key) { |
2582 ON_BAILOUT("v8::Object::GetRealNamedPropertyInPrototypeChain()", | 2604 ON_BAILOUT("v8::Object::GetRealNamedPropertyInPrototypeChain()", |
2583 return Local<Value>()); | 2605 return Local<Value>()); |
2584 ENTER_V8; | 2606 ENTER_V8; |
2585 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 2607 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
2586 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 2608 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
2587 i::LookupResult lookup; | 2609 i::LookupResult lookup; |
2588 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup); | 2610 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup); |
2589 if (lookup.IsProperty()) { | 2611 return GetPropertyByLookup(self_obj, key_obj, &lookup); |
2590 PropertyAttributes attributes; | |
2591 i::Object* property = | |
2592 self_obj->GetProperty(*self_obj, | |
2593 &lookup, | |
2594 *key_obj, | |
2595 &attributes)->ToObjectUnchecked(); | |
2596 i::Handle<i::Object> result(property); | |
2597 return Utils::ToLocal(result); | |
2598 } | |
2599 return Local<Value>(); // No real property was found in prototype chain. | |
2600 } | 2612 } |
2601 | 2613 |
2602 | 2614 |
2603 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { | 2615 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
2604 ON_BAILOUT("v8::Object::GetRealNamedProperty()", return Local<Value>()); | 2616 ON_BAILOUT("v8::Object::GetRealNamedProperty()", return Local<Value>()); |
2605 ENTER_V8; | 2617 ENTER_V8; |
2606 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 2618 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
2607 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 2619 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
2608 i::LookupResult lookup; | 2620 i::LookupResult lookup; |
2609 self_obj->LookupRealNamedProperty(*key_obj, &lookup); | 2621 self_obj->LookupRealNamedProperty(*key_obj, &lookup); |
2610 if (lookup.IsProperty()) { | 2622 return GetPropertyByLookup(self_obj, key_obj, &lookup); |
2611 PropertyAttributes attributes; | |
2612 i::Object* property = | |
2613 self_obj->GetProperty(*self_obj, | |
2614 &lookup, | |
2615 *key_obj, | |
2616 &attributes)->ToObjectUnchecked(); | |
2617 i::Handle<i::Object> result(property); | |
2618 return Utils::ToLocal(result); | |
2619 } | |
2620 return Local<Value>(); // No real property was found in prototype chain. | |
2621 } | 2623 } |
2622 | 2624 |
2623 | 2625 |
2624 // Turns on access checks by copying the map and setting the check flag. | 2626 // Turns on access checks by copying the map and setting the check flag. |
2625 // Because the object gets a new map, existing inline cache caching | 2627 // Because the object gets a new map, existing inline cache caching |
2626 // the old map of this object will fail. | 2628 // the old map of this object will fail. |
2627 void v8::Object::TurnOnAccessCheck() { | 2629 void v8::Object::TurnOnAccessCheck() { |
2628 ON_BAILOUT("v8::Object::TurnOnAccessCheck()", return); | 2630 ON_BAILOUT("v8::Object::TurnOnAccessCheck()", return); |
2629 ENTER_V8; | 2631 ENTER_V8; |
2630 HandleScope scope; | 2632 HandleScope scope; |
(...skipping 2606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5237 | 5239 |
5238 | 5240 |
5239 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5241 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5240 HandleScopeImplementer* thread_local = | 5242 HandleScopeImplementer* thread_local = |
5241 reinterpret_cast<HandleScopeImplementer*>(storage); | 5243 reinterpret_cast<HandleScopeImplementer*>(storage); |
5242 thread_local->IterateThis(v); | 5244 thread_local->IterateThis(v); |
5243 return storage + ArchiveSpacePerThread(); | 5245 return storage + ArchiveSpacePerThread(); |
5244 } | 5246 } |
5245 | 5247 |
5246 } } // namespace v8::internal | 5248 } } // namespace v8::internal |
OLD | NEW |