Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: src/api.cc

Issue 6685087: Make exception thrown via v8 public API propagate to v8::TryCatch as JS thrown exceptions do. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Next round Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2571 return Utils::ToLocal(result); 2571 return Utils::ToLocal(result);
2572 } 2572 }
2573 2573
2574 2574
2575 bool v8::Object::SetPrototype(Handle<Value> value) { 2575 bool v8::Object::SetPrototype(Handle<Value> value) {
2576 i::Isolate* isolate = i::Isolate::Current(); 2576 i::Isolate* isolate = i::Isolate::Current();
2577 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false); 2577 ON_BAILOUT(isolate, "v8::Object::SetPrototype()", return false);
2578 ENTER_V8; 2578 ENTER_V8;
2579 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 2579 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
2580 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 2580 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
2581 // We do not allow exceptions thrown while setting the prototype
2582 // to propagate outside.
2583 TryCatch try_catch;
2581 EXCEPTION_PREAMBLE(); 2584 EXCEPTION_PREAMBLE();
2582 i::Handle<i::Object> result = i::SetPrototype(self, value_obj); 2585 i::Handle<i::Object> result = i::SetPrototype(self, value_obj);
2583 has_pending_exception = result.is_null(); 2586 has_pending_exception = result.is_null();
2584 EXCEPTION_BAILOUT_CHECK(false); 2587 EXCEPTION_BAILOUT_CHECK(false);
2585 return true; 2588 return true;
2586 } 2589 }
2587 2590
2588 2591
2589 Local<Object> v8::Object::FindInstanceInPrototypeChain( 2592 Local<Object> v8::Object::FindInstanceInPrototypeChain(
2590 v8::Handle<FunctionTemplate> tmpl) { 2593 v8::Handle<FunctionTemplate> tmpl) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 } 2774 }
2772 2775
2773 2776
2774 bool v8::Object::HasIndexedLookupInterceptor() { 2777 bool v8::Object::HasIndexedLookupInterceptor() {
2775 ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasIndexedLookupInterceptor()", 2778 ON_BAILOUT(i::Isolate::Current(), "v8::Object::HasIndexedLookupInterceptor()",
2776 return false); 2779 return false);
2777 return Utils::OpenHandle(this)->HasIndexedInterceptor(); 2780 return Utils::OpenHandle(this)->HasIndexedInterceptor();
2778 } 2781 }
2779 2782
2780 2783
2784 static Local<Value> GetPropertyByLookup(i::Isolate* isolate,
Mads Ager (chromium) 2011/03/22 07:32:14 The isolate parameter is not used. Remove?
antonm 2011/03/22 10:57:06 It's implicitly used in EXCEPTION_BAILOUT_CHECK.
2785 i::Handle<i::JSObject> receiver,
2786 i::Handle<i::String> name,
2787 i::LookupResult* lookup) {
2788 if (!lookup->IsProperty()) {
2789 // No real property was found.
2790 return Local<Value>();
2791 }
2792
2793 // If the property being looked up is a callback, it can throw
2794 // an exception.
2795 EXCEPTION_PREAMBLE();
2796 i::Handle<i::Object> result = i::GetProperty(receiver, name, lookup);
2797 has_pending_exception = result.is_null();
2798 EXCEPTION_BAILOUT_CHECK(Local<Value>());
2799
2800 return Utils::ToLocal(result);
2801 }
2802
2803
2781 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain( 2804 Local<Value> v8::Object::GetRealNamedPropertyInPrototypeChain(
2782 Handle<String> key) { 2805 Handle<String> key) {
2783 ON_BAILOUT(i::Isolate::Current(), 2806 i::Isolate* isolate = i::Isolate::Current();
2807 ON_BAILOUT(isolate,
2784 "v8::Object::GetRealNamedPropertyInPrototypeChain()", 2808 "v8::Object::GetRealNamedPropertyInPrototypeChain()",
2785 return Local<Value>()); 2809 return Local<Value>());
2786 ENTER_V8; 2810 ENTER_V8;
2787 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); 2811 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
2788 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 2812 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2789 i::LookupResult lookup; 2813 i::LookupResult lookup;
2790 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup); 2814 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup);
2791 if (lookup.IsProperty()) { 2815 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup);
2792 PropertyAttributes attributes;
2793 i::Object* property =
2794 self_obj->GetProperty(*self_obj,
2795 &lookup,
2796 *key_obj,
2797 &attributes)->ToObjectUnchecked();
2798 i::Handle<i::Object> result(property);
2799 return Utils::ToLocal(result);
2800 }
2801 return Local<Value>(); // No real property was found in prototype chain.
2802 } 2816 }
2803 2817
2804 2818
2805 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { 2819 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) {
2806 ON_BAILOUT(i::Isolate::Current(), "v8::Object::GetRealNamedProperty()", 2820 i::Isolate* isolate = i::Isolate::Current();
2821 ON_BAILOUT(isolate, "v8::Object::GetRealNamedProperty()",
2807 return Local<Value>()); 2822 return Local<Value>());
2808 ENTER_V8; 2823 ENTER_V8;
2809 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); 2824 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this);
2810 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); 2825 i::Handle<i::String> key_obj = Utils::OpenHandle(*key);
2811 i::LookupResult lookup; 2826 i::LookupResult lookup;
2812 self_obj->LookupRealNamedProperty(*key_obj, &lookup); 2827 self_obj->LookupRealNamedProperty(*key_obj, &lookup);
2813 if (lookup.IsProperty()) { 2828 return GetPropertyByLookup(isolate, self_obj, key_obj, &lookup);
2814 PropertyAttributes attributes;
2815 i::Object* property =
2816 self_obj->GetProperty(*self_obj,
2817 &lookup,
2818 *key_obj,
2819 &attributes)->ToObjectUnchecked();
2820 i::Handle<i::Object> result(property);
2821 return Utils::ToLocal(result);
2822 }
2823 return Local<Value>(); // No real property was found in prototype chain.
2824 } 2829 }
2825 2830
2826 2831
2827 // Turns on access checks by copying the map and setting the check flag. 2832 // Turns on access checks by copying the map and setting the check flag.
2828 // Because the object gets a new map, existing inline cache caching 2833 // Because the object gets a new map, existing inline cache caching
2829 // the old map of this object will fail. 2834 // the old map of this object will fail.
2830 void v8::Object::TurnOnAccessCheck() { 2835 void v8::Object::TurnOnAccessCheck() {
2831 i::Isolate* isolate = i::Isolate::Current(); 2836 i::Isolate* isolate = i::Isolate::Current();
2832 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return); 2837 ON_BAILOUT(isolate, "v8::Object::TurnOnAccessCheck()", return);
2833 ENTER_V8; 2838 ENTER_V8;
(...skipping 2774 matching lines...) Expand 10 before | Expand all | Expand 10 after
5608 5613
5609 5614
5610 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5615 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5611 HandleScopeImplementer* thread_local = 5616 HandleScopeImplementer* thread_local =
5612 reinterpret_cast<HandleScopeImplementer*>(storage); 5617 reinterpret_cast<HandleScopeImplementer*>(storage);
5613 thread_local->IterateThis(v); 5618 thread_local->IterateThis(v);
5614 return storage + ArchiveSpacePerThread(); 5619 return storage + ArchiveSpacePerThread();
5615 } 5620 }
5616 5621
5617 } } // namespace v8::internal 5622 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698