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

Side by Side Diff: src/objects.cc

Issue 23661004: add isolate parameter for Execution::Call (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase Created 7 years, 3 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 | « src/json-stringifier.h ('k') | src/runtime.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 Debug* debug = isolate->debug(); 478 Debug* debug = isolate->debug();
479 // Handle stepping into a getter if step into is active. 479 // Handle stepping into a getter if step into is active.
480 // TODO(rossberg): should this apply to getters that are function proxies? 480 // TODO(rossberg): should this apply to getters that are function proxies?
481 if (debug->StepInActive() && fun->IsJSFunction()) { 481 if (debug->StepInActive() && fun->IsJSFunction()) {
482 debug->HandleStepIn( 482 debug->HandleStepIn(
483 Handle<JSFunction>::cast(fun), Handle<Object>::null(), 0, false); 483 Handle<JSFunction>::cast(fun), Handle<Object>::null(), 0, false);
484 } 484 }
485 #endif 485 #endif
486 486
487 bool has_pending_exception; 487 bool has_pending_exception;
488 Handle<Object> result = 488 Handle<Object> result = Execution::Call(
489 Execution::Call(fun, self, 0, NULL, &has_pending_exception, true); 489 isolate, fun, self, 0, NULL, &has_pending_exception, true);
490 // Check for pending exception and return the result. 490 // Check for pending exception and return the result.
491 if (has_pending_exception) return Failure::Exception(); 491 if (has_pending_exception) return Failure::Exception();
492 return *result; 492 return *result;
493 } 493 }
494 494
495 495
496 // Only deal with CALLBACKS and INTERCEPTOR 496 // Only deal with CALLBACKS and INTERCEPTOR
497 MaybeObject* JSObject::GetPropertyWithFailedAccessCheck( 497 MaybeObject* JSObject::GetPropertyWithFailedAccessCheck(
498 Object* receiver, 498 Object* receiver,
499 LookupResult* result, 499 LookupResult* result,
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2082 Handle<Name> name, 2082 Handle<Name> name,
2083 Handle<Object> old_value) { 2083 Handle<Object> old_value) {
2084 Isolate* isolate = object->GetIsolate(); 2084 Isolate* isolate = object->GetIsolate();
2085 HandleScope scope(isolate); 2085 HandleScope scope(isolate);
2086 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str); 2086 Handle<String> type = isolate->factory()->InternalizeUtf8String(type_str);
2087 if (object->IsJSGlobalObject()) { 2087 if (object->IsJSGlobalObject()) {
2088 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate); 2088 object = handle(JSGlobalObject::cast(*object)->global_receiver(), isolate);
2089 } 2089 }
2090 Handle<Object> args[] = { type, object, name, old_value }; 2090 Handle<Object> args[] = { type, object, name, old_value };
2091 bool threw; 2091 bool threw;
2092 Execution::Call(Handle<JSFunction>(isolate->observers_notify_change()), 2092 Execution::Call(isolate,
2093 Handle<JSFunction>(isolate->observers_notify_change()),
2093 isolate->factory()->undefined_value(), 2094 isolate->factory()->undefined_value(),
2094 old_value->IsTheHole() ? 3 : 4, args, 2095 old_value->IsTheHole() ? 3 : 4, args,
2095 &threw); 2096 &threw);
2096 ASSERT(!threw); 2097 ASSERT(!threw);
2097 } 2098 }
2098 2099
2099 2100
2100 void JSObject::DeliverChangeRecords(Isolate* isolate) { 2101 void JSObject::DeliverChangeRecords(Isolate* isolate) {
2101 ASSERT(isolate->observer_delivery_pending()); 2102 ASSERT(isolate->observer_delivery_pending());
2102 bool threw = false; 2103 bool threw = false;
2103 Execution::Call( 2104 Execution::Call(
2105 isolate,
2104 isolate->observers_deliver_changes(), 2106 isolate->observers_deliver_changes(),
2105 isolate->factory()->undefined_value(), 2107 isolate->factory()->undefined_value(),
2106 0, 2108 0,
2107 NULL, 2109 NULL,
2108 &threw); 2110 &threw);
2109 ASSERT(!threw); 2111 ASSERT(!threw);
2110 isolate->set_observer_delivery_pending(false); 2112 isolate->set_observer_delivery_pending(false);
2111 } 2113 }
2112 2114
2113 2115
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 Debug* debug = isolate->debug(); 2872 Debug* debug = isolate->debug();
2871 // Handle stepping into a setter if step into is active. 2873 // Handle stepping into a setter if step into is active.
2872 // TODO(rossberg): should this apply to getters that are function proxies? 2874 // TODO(rossberg): should this apply to getters that are function proxies?
2873 if (debug->StepInActive() && fun->IsJSFunction()) { 2875 if (debug->StepInActive() && fun->IsJSFunction()) {
2874 debug->HandleStepIn( 2876 debug->HandleStepIn(
2875 Handle<JSFunction>::cast(fun), Handle<Object>::null(), 0, false); 2877 Handle<JSFunction>::cast(fun), Handle<Object>::null(), 0, false);
2876 } 2878 }
2877 #endif 2879 #endif
2878 bool has_pending_exception; 2880 bool has_pending_exception;
2879 Handle<Object> argv[] = { value_handle }; 2881 Handle<Object> argv[] = { value_handle };
2880 Execution::Call(fun, self, ARRAY_SIZE(argv), argv, &has_pending_exception); 2882 Execution::Call(
2883 isolate, fun, self, ARRAY_SIZE(argv), argv, &has_pending_exception);
2881 // Check for pending exception and return the result. 2884 // Check for pending exception and return the result.
2882 if (has_pending_exception) return Failure::Exception(); 2885 if (has_pending_exception) return Failure::Exception();
2883 return *value_handle; 2886 return *value_handle;
2884 } 2887 }
2885 2888
2886 2889
2887 MaybeObject* JSObject::SetElementWithCallbackSetterInPrototypes( 2890 MaybeObject* JSObject::SetElementWithCallbackSetterInPrototypes(
2888 uint32_t index, 2891 uint32_t index,
2889 Object* value, 2892 Object* value,
2890 bool* found, 2893 bool* found,
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 if (isolate->has_pending_exception()) return Failure::Exception(); 3488 if (isolate->has_pending_exception()) return Failure::Exception();
3486 3489
3487 if (result->IsUndefined()) { 3490 if (result->IsUndefined()) {
3488 *done = false; 3491 *done = false;
3489 return isolate->heap()->the_hole_value(); 3492 return isolate->heap()->the_hole_value();
3490 } 3493 }
3491 3494
3492 // Emulate [[GetProperty]] semantics for proxies. 3495 // Emulate [[GetProperty]] semantics for proxies.
3493 bool has_pending_exception; 3496 bool has_pending_exception;
3494 Handle<Object> argv[] = { result }; 3497 Handle<Object> argv[] = { result };
3495 Handle<Object> desc = 3498 Handle<Object> desc = Execution::Call(
3496 Execution::Call(isolate->to_complete_property_descriptor(), result, 3499 isolate, isolate->to_complete_property_descriptor(), result,
3497 ARRAY_SIZE(argv), argv, &has_pending_exception); 3500 ARRAY_SIZE(argv), argv, &has_pending_exception);
3498 if (has_pending_exception) return Failure::Exception(); 3501 if (has_pending_exception) return Failure::Exception();
3499 3502
3500 // [[GetProperty]] requires to check that all properties are configurable. 3503 // [[GetProperty]] requires to check that all properties are configurable.
3501 Handle<String> configurable_name = 3504 Handle<String> configurable_name =
3502 isolate->factory()->InternalizeOneByteString( 3505 isolate->factory()->InternalizeOneByteString(
3503 STATIC_ASCII_VECTOR("configurable_")); 3506 STATIC_ASCII_VECTOR("configurable_"));
3504 Handle<Object> configurable( 3507 Handle<Object> configurable(
3505 v8::internal::GetProperty(isolate, desc, configurable_name)); 3508 v8::internal::GetProperty(isolate, desc, configurable_name));
3506 ASSERT(!isolate->has_pending_exception()); 3509 ASSERT(!isolate->has_pending_exception());
3507 ASSERT(configurable->IsTrue() || configurable->IsFalse()); 3510 ASSERT(configurable->IsTrue() || configurable->IsFalse());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
3610 3613
3611 Handle<Object> args[] = { name }; 3614 Handle<Object> args[] = { name };
3612 Handle<Object> result = CallTrap( 3615 Handle<Object> result = CallTrap(
3613 "getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args); 3616 "getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args);
3614 if (isolate->has_pending_exception()) return NONE; 3617 if (isolate->has_pending_exception()) return NONE;
3615 3618
3616 if (result->IsUndefined()) return ABSENT; 3619 if (result->IsUndefined()) return ABSENT;
3617 3620
3618 bool has_pending_exception; 3621 bool has_pending_exception;
3619 Handle<Object> argv[] = { result }; 3622 Handle<Object> argv[] = { result };
3620 Handle<Object> desc = 3623 Handle<Object> desc = Execution::Call(
3621 Execution::Call(isolate->to_complete_property_descriptor(), result, 3624 isolate, isolate->to_complete_property_descriptor(), result,
3622 ARRAY_SIZE(argv), argv, &has_pending_exception); 3625 ARRAY_SIZE(argv), argv, &has_pending_exception);
3623 if (has_pending_exception) return NONE; 3626 if (has_pending_exception) return NONE;
3624 3627
3625 // Convert result to PropertyAttributes. 3628 // Convert result to PropertyAttributes.
3626 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString( 3629 Handle<String> enum_n = isolate->factory()->InternalizeOneByteString(
3627 STATIC_ASCII_VECTOR("enumerable_")); 3630 STATIC_ASCII_VECTOR("enumerable_"));
3628 Handle<Object> enumerable(v8::internal::GetProperty(isolate, desc, enum_n)); 3631 Handle<Object> enumerable(v8::internal::GetProperty(isolate, desc, enum_n));
3629 if (isolate->has_pending_exception()) return NONE; 3632 if (isolate->has_pending_exception()) return NONE;
3630 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString( 3633 Handle<String> conf_n = isolate->factory()->InternalizeOneByteString(
3631 STATIC_ASCII_VECTOR("configurable_")); 3634 STATIC_ASCII_VECTOR("configurable_"));
3632 Handle<Object> configurable(v8::internal::GetProperty(isolate, desc, conf_n)); 3635 Handle<Object> configurable(v8::internal::GetProperty(isolate, desc, conf_n));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3710 Handle<Object> args[] = { handler, trap_name }; 3713 Handle<Object> args[] = { handler, trap_name };
3711 Handle<Object> error = isolate->factory()->NewTypeError( 3714 Handle<Object> error = isolate->factory()->NewTypeError(
3712 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args))); 3715 "handler_trap_missing", HandleVector(args, ARRAY_SIZE(args)));
3713 isolate->Throw(*error); 3716 isolate->Throw(*error);
3714 return Handle<Object>(); 3717 return Handle<Object>();
3715 } 3718 }
3716 trap = Handle<Object>(derived); 3719 trap = Handle<Object>(derived);
3717 } 3720 }
3718 3721
3719 bool threw; 3722 bool threw;
3720 return Execution::Call(trap, handler, argc, argv, &threw); 3723 return Execution::Call(isolate, trap, handler, argc, argv, &threw);
3721 } 3724 }
3722 3725
3723 3726
3724 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) { 3727 void JSObject::AllocateStorageForMap(Handle<JSObject> object, Handle<Map> map) {
3725 CALL_HEAP_FUNCTION_VOID( 3728 CALL_HEAP_FUNCTION_VOID(
3726 object->GetIsolate(), 3729 object->GetIsolate(),
3727 object->AllocateStorageForMap(*map)); 3730 object->AllocateStorageForMap(*map));
3728 } 3731 }
3729 3732
3730 3733
(...skipping 7307 matching lines...) Expand 10 before | Expand all | Expand 10 after
11038 Isolate* isolate = object->GetIsolate(); 11041 Isolate* isolate = object->GetIsolate();
11039 HandleScope scope(isolate); 11042 HandleScope scope(isolate);
11040 Handle<Object> index_object = isolate->factory()->NewNumberFromUint(index); 11043 Handle<Object> index_object = isolate->factory()->NewNumberFromUint(index);
11041 Handle<Object> add_count_object = 11044 Handle<Object> add_count_object =
11042 isolate->factory()->NewNumberFromUint(add_count); 11045 isolate->factory()->NewNumberFromUint(add_count);
11043 11046
11044 Handle<Object> args[] = 11047 Handle<Object> args[] =
11045 { object, index_object, deleted, add_count_object }; 11048 { object, index_object, deleted, add_count_object };
11046 11049
11047 bool threw; 11050 bool threw;
11048 Execution::Call(Handle<JSFunction>(isolate->observers_enqueue_splice()), 11051 Execution::Call(isolate,
11052 Handle<JSFunction>(isolate->observers_enqueue_splice()),
11049 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, 11053 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args,
11050 &threw); 11054 &threw);
11051 ASSERT(!threw); 11055 ASSERT(!threw);
11052 } 11056 }
11053 11057
11054 11058
11055 static void BeginPerformSplice(Handle<JSArray> object) { 11059 static void BeginPerformSplice(Handle<JSArray> object) {
11056 Isolate* isolate = object->GetIsolate(); 11060 Isolate* isolate = object->GetIsolate();
11057 HandleScope scope(isolate); 11061 HandleScope scope(isolate);
11058 Handle<Object> args[] = { object }; 11062 Handle<Object> args[] = { object };
11059 11063
11060 bool threw; 11064 bool threw;
11061 Execution::Call(Handle<JSFunction>(isolate->observers_begin_perform_splice()), 11065 Execution::Call(isolate,
11066 Handle<JSFunction>(isolate->observers_begin_perform_splice()),
11062 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, 11067 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args,
11063 &threw); 11068 &threw);
11064 ASSERT(!threw); 11069 ASSERT(!threw);
11065 } 11070 }
11066 11071
11067 11072
11068 static void EndPerformSplice(Handle<JSArray> object) { 11073 static void EndPerformSplice(Handle<JSArray> object) {
11069 Isolate* isolate = object->GetIsolate(); 11074 Isolate* isolate = object->GetIsolate();
11070 HandleScope scope(isolate); 11075 HandleScope scope(isolate);
11071 Handle<Object> args[] = { object }; 11076 Handle<Object> args[] = { object };
11072 11077
11073 bool threw; 11078 bool threw;
11074 Execution::Call(Handle<JSFunction>(isolate->observers_end_perform_splice()), 11079 Execution::Call(isolate,
11080 Handle<JSFunction>(isolate->observers_end_perform_splice()),
11075 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, 11081 isolate->factory()->undefined_value(), ARRAY_SIZE(args), args,
11076 &threw); 11082 &threw);
11077 ASSERT(!threw); 11083 ASSERT(!threw);
11078 } 11084 }
11079 11085
11080 11086
11081 MaybeObject* JSArray::SetElementsLength(Object* len) { 11087 MaybeObject* JSArray::SetElementsLength(Object* len) {
11082 // We should never end in here with a pixel or external array. 11088 // We should never end in here with a pixel or external array.
11083 ASSERT(AllowsSetElementsLength()); 11089 ASSERT(AllowsSetElementsLength());
11084 if (!(FLAG_harmony_observation && map()->is_observed())) 11090 if (!(FLAG_harmony_observation && map()->is_observed()))
(...skipping 4951 matching lines...) Expand 10 before | Expand all | Expand 10 after
16036 #define ERROR_MESSAGES_TEXTS(C, T) T, 16042 #define ERROR_MESSAGES_TEXTS(C, T) T,
16037 static const char* error_messages_[] = { 16043 static const char* error_messages_[] = {
16038 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 16044 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
16039 }; 16045 };
16040 #undef ERROR_MESSAGES_TEXTS 16046 #undef ERROR_MESSAGES_TEXTS
16041 return error_messages_[reason]; 16047 return error_messages_[reason];
16042 } 16048 }
16043 16049
16044 16050
16045 } } // namespace v8::internal 16051 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/json-stringifier.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698