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

Side by Side Diff: src/objects.cc

Issue 17059005: Make sure ExternalCallbackScope is always created when VM state changes to EXTERNAL (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 7 years, 6 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/handles.cc ('k') | src/stub-cache.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 29 matching lines...) Expand all
40 #include "full-codegen.h" 40 #include "full-codegen.h"
41 #include "hydrogen.h" 41 #include "hydrogen.h"
42 #include "objects-inl.h" 42 #include "objects-inl.h"
43 #include "objects-visiting.h" 43 #include "objects-visiting.h"
44 #include "objects-visiting-inl.h" 44 #include "objects-visiting-inl.h"
45 #include "macro-assembler.h" 45 #include "macro-assembler.h"
46 #include "mark-compact.h" 46 #include "mark-compact.h"
47 #include "safepoint-table.h" 47 #include "safepoint-table.h"
48 #include "string-stream.h" 48 #include "string-stream.h"
49 #include "utils.h" 49 #include "utils.h"
50 #include "vm-state-inl.h"
51 50
52 #ifdef ENABLE_DISASSEMBLER 51 #ifdef ENABLE_DISASSEMBLER
53 #include "disasm.h" 52 #include "disasm.h"
54 #include "disassembler.h" 53 #include "disassembler.h"
55 #endif 54 #endif
56 55
57 namespace v8 { 56 namespace v8 {
58 namespace internal { 57 namespace internal {
59 58
60 59
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } 367 }
369 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(structure); 368 ExecutableAccessorInfo* data = ExecutableAccessorInfo::cast(structure);
370 Object* fun_obj = data->getter(); 369 Object* fun_obj = data->getter();
371 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); 370 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj);
372 if (call_fun == NULL) return isolate->heap()->undefined_value(); 371 if (call_fun == NULL) return isolate->heap()->undefined_value();
373 HandleScope scope(isolate); 372 HandleScope scope(isolate);
374 JSObject* self = JSObject::cast(receiver); 373 JSObject* self = JSObject::cast(receiver);
375 Handle<String> key(String::cast(name)); 374 Handle<String> key(String::cast(name));
376 LOG(isolate, ApiNamedPropertyAccess("load", self, name)); 375 LOG(isolate, ApiNamedPropertyAccess("load", self, name));
377 PropertyCallbackArguments args(isolate, data->data(), self, this); 376 PropertyCallbackArguments args(isolate, data->data(), self, this);
378 v8::Handle<v8::Value> result; 377 v8::Handle<v8::Value> result =
379 { 378 args.Call(call_fun, v8::Utils::ToLocal(key));
380 // Leaving JavaScript.
381 VMState<EXTERNAL> state(isolate);
382 ExternalCallbackScope call_scope(isolate,
383 v8::ToCData<Address>(fun_obj));
384 result = args.Call(call_fun, v8::Utils::ToLocal(key));
385 }
386 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 379 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
387 if (result.IsEmpty()) { 380 if (result.IsEmpty()) {
388 return isolate->heap()->undefined_value(); 381 return isolate->heap()->undefined_value();
389 } 382 }
390 Object* return_value = *v8::Utils::OpenHandle(*result); 383 Object* return_value = *v8::Utils::OpenHandle(*result);
391 return_value->VerifyApiCallResultType(); 384 return_value->VerifyApiCallResultType();
392 return return_value; 385 return return_value;
393 } 386 }
394 387
395 // __defineGetter__ callback 388 // __defineGetter__ callback
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 HandleScope scope(isolate); 2722 HandleScope scope(isolate);
2730 Handle<JSObject> this_handle(this); 2723 Handle<JSObject> this_handle(this);
2731 Handle<String> name_handle(String::cast(name)); 2724 Handle<String> name_handle(String::cast(name));
2732 Handle<Object> value_handle(value, isolate); 2725 Handle<Object> value_handle(value, isolate);
2733 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 2726 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
2734 if (!interceptor->setter()->IsUndefined()) { 2727 if (!interceptor->setter()->IsUndefined()) {
2735 LOG(isolate, ApiNamedPropertyAccess("interceptor-named-set", this, name)); 2728 LOG(isolate, ApiNamedPropertyAccess("interceptor-named-set", this, name));
2736 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); 2729 PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
2737 v8::NamedPropertySetter setter = 2730 v8::NamedPropertySetter setter =
2738 v8::ToCData<v8::NamedPropertySetter>(interceptor->setter()); 2731 v8::ToCData<v8::NamedPropertySetter>(interceptor->setter());
2739 v8::Handle<v8::Value> result; 2732 Handle<Object> value_unhole(value->IsTheHole() ?
2740 { 2733 isolate->heap()->undefined_value() :
2741 // Leaving JavaScript. 2734 value,
2742 VMState<EXTERNAL> state(isolate); 2735 isolate);
2743 Handle<Object> value_unhole(value->IsTheHole() ? 2736 v8::Handle<v8::Value> result = args.Call(setter,
2744 isolate->heap()->undefined_value() : 2737 v8::Utils::ToLocal(name_handle),
2745 value, 2738 v8::Utils::ToLocal(value_unhole));
2746 isolate);
2747 result = args.Call(setter,
2748 v8::Utils::ToLocal(name_handle),
2749 v8::Utils::ToLocal(value_unhole));
2750 }
2751 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 2739 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
2752 if (!result.IsEmpty()) return *value_handle; 2740 if (!result.IsEmpty()) return *value_handle;
2753 } 2741 }
2754 MaybeObject* raw_result = 2742 MaybeObject* raw_result =
2755 this_handle->SetPropertyPostInterceptor(*name_handle, 2743 this_handle->SetPropertyPostInterceptor(*name_handle,
2756 *value_handle, 2744 *value_handle,
2757 attributes, 2745 attributes,
2758 strict_mode, 2746 strict_mode,
2759 PERFORM_EXTENSIBILITY_CHECK); 2747 PERFORM_EXTENSIBILITY_CHECK);
2760 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 2748 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 ARRAY_SIZE(args))); 2827 ARRAY_SIZE(args)));
2840 return isolate->Throw(*error); 2828 return isolate->Throw(*error);
2841 } 2829 }
2842 // TODO(rossberg): Support symbols in the API. 2830 // TODO(rossberg): Support symbols in the API.
2843 if (name->IsSymbol()) return value; 2831 if (name->IsSymbol()) return value;
2844 Object* call_obj = data->setter(); 2832 Object* call_obj = data->setter();
2845 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); 2833 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj);
2846 if (call_fun == NULL) return value; 2834 if (call_fun == NULL) return value;
2847 Handle<String> key(String::cast(name)); 2835 Handle<String> key(String::cast(name));
2848 LOG(isolate, ApiNamedPropertyAccess("store", this, name)); 2836 LOG(isolate, ApiNamedPropertyAccess("store", this, name));
2849 PropertyCallbackArguments 2837 PropertyCallbackArguments args(
2850 args(isolate, data->data(), this, JSObject::cast(holder)); 2838 isolate, data->data(), this, JSObject::cast(holder));
2851 { 2839 args.Call(call_fun,
2852 // Leaving JavaScript. 2840 v8::Utils::ToLocal(key),
2853 VMState<EXTERNAL> state(isolate); 2841 v8::Utils::ToLocal(value_handle));
2854 ExternalCallbackScope call_scope(isolate,
2855 v8::ToCData<Address>(call_obj));
2856 args.Call(call_fun,
2857 v8::Utils::ToLocal(key),
2858 v8::Utils::ToLocal(value_handle));
2859 }
2860 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 2842 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
2861 return *value_handle; 2843 return *value_handle;
2862 } 2844 }
2863 2845
2864 if (structure->IsAccessorPair()) { 2846 if (structure->IsAccessorPair()) {
2865 Object* setter = AccessorPair::cast(structure)->setter(); 2847 Object* setter = AccessorPair::cast(structure)->setter();
2866 if (setter->IsSpecFunction()) { 2848 if (setter->IsSpecFunction()) {
2867 // TODO(rossberg): nicer would be to cast to some JSCallable here... 2849 // TODO(rossberg): nicer would be to cast to some JSCallable here...
2868 return SetPropertyWithDefinedSetter(JSReceiver::cast(setter), value); 2850 return SetPropertyWithDefinedSetter(JSReceiver::cast(setter), value);
2869 } else { 2851 } else {
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after
4180 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 4162 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
4181 Handle<JSObject> receiver_handle(receiver); 4163 Handle<JSObject> receiver_handle(receiver);
4182 Handle<JSObject> holder_handle(this); 4164 Handle<JSObject> holder_handle(this);
4183 Handle<String> name_handle(String::cast(name)); 4165 Handle<String> name_handle(String::cast(name));
4184 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this); 4166 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this);
4185 if (!interceptor->query()->IsUndefined()) { 4167 if (!interceptor->query()->IsUndefined()) {
4186 v8::NamedPropertyQuery query = 4168 v8::NamedPropertyQuery query =
4187 v8::ToCData<v8::NamedPropertyQuery>(interceptor->query()); 4169 v8::ToCData<v8::NamedPropertyQuery>(interceptor->query());
4188 LOG(isolate, 4170 LOG(isolate,
4189 ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name)); 4171 ApiNamedPropertyAccess("interceptor-named-has", *holder_handle, name));
4190 v8::Handle<v8::Integer> result; 4172 v8::Handle<v8::Integer> result =
4191 { 4173 args.Call(query, v8::Utils::ToLocal(name_handle));
4192 // Leaving JavaScript.
4193 VMState<EXTERNAL> state(isolate);
4194 result = args.Call(query, v8::Utils::ToLocal(name_handle));
4195 }
4196 if (!result.IsEmpty()) { 4174 if (!result.IsEmpty()) {
4197 ASSERT(result->IsInt32()); 4175 ASSERT(result->IsInt32());
4198 return static_cast<PropertyAttributes>(result->Int32Value()); 4176 return static_cast<PropertyAttributes>(result->Int32Value());
4199 } 4177 }
4200 } else if (!interceptor->getter()->IsUndefined()) { 4178 } else if (!interceptor->getter()->IsUndefined()) {
4201 v8::NamedPropertyGetter getter = 4179 v8::NamedPropertyGetter getter =
4202 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); 4180 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
4203 LOG(isolate, 4181 LOG(isolate,
4204 ApiNamedPropertyAccess("interceptor-named-get-has", this, name)); 4182 ApiNamedPropertyAccess("interceptor-named-get-has", this, name));
4205 v8::Handle<v8::Value> result; 4183 v8::Handle<v8::Value> result =
4206 { 4184 args.Call(getter, v8::Utils::ToLocal(name_handle));
4207 // Leaving JavaScript.
4208 VMState<EXTERNAL> state(isolate);
4209 result = args.Call(getter, v8::Utils::ToLocal(name_handle));
4210 }
4211 if (!result.IsEmpty()) return DONT_ENUM; 4185 if (!result.IsEmpty()) return DONT_ENUM;
4212 } 4186 }
4213 return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle, 4187 return holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle,
4214 *name_handle, 4188 *name_handle,
4215 continue_search); 4189 continue_search);
4216 } 4190 }
4217 4191
4218 4192
4219 PropertyAttributes JSReceiver::GetPropertyAttributeWithReceiver( 4193 PropertyAttributes JSReceiver::GetPropertyAttributeWithReceiver(
4220 JSReceiver* receiver, 4194 JSReceiver* receiver,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
4320 HandleScope scope(isolate); 4294 HandleScope scope(isolate);
4321 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); 4295 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor());
4322 Handle<JSReceiver> hreceiver(receiver); 4296 Handle<JSReceiver> hreceiver(receiver);
4323 Handle<JSObject> holder(this); 4297 Handle<JSObject> holder(this);
4324 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this); 4298 PropertyCallbackArguments args(isolate, interceptor->data(), receiver, this);
4325 if (!interceptor->query()->IsUndefined()) { 4299 if (!interceptor->query()->IsUndefined()) {
4326 v8::IndexedPropertyQuery query = 4300 v8::IndexedPropertyQuery query =
4327 v8::ToCData<v8::IndexedPropertyQuery>(interceptor->query()); 4301 v8::ToCData<v8::IndexedPropertyQuery>(interceptor->query());
4328 LOG(isolate, 4302 LOG(isolate,
4329 ApiIndexedPropertyAccess("interceptor-indexed-has", this, index)); 4303 ApiIndexedPropertyAccess("interceptor-indexed-has", this, index));
4330 v8::Handle<v8::Integer> result; 4304 v8::Handle<v8::Integer> result = args.Call(query, index);
4331 {
4332 // Leaving JavaScript.
4333 VMState<EXTERNAL> state(isolate);
4334 result = args.Call(query, index);
4335 }
4336 if (!result.IsEmpty()) 4305 if (!result.IsEmpty())
4337 return static_cast<PropertyAttributes>(result->Int32Value()); 4306 return static_cast<PropertyAttributes>(result->Int32Value());
4338 } else if (!interceptor->getter()->IsUndefined()) { 4307 } else if (!interceptor->getter()->IsUndefined()) {
4339 v8::IndexedPropertyGetter getter = 4308 v8::IndexedPropertyGetter getter =
4340 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); 4309 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter());
4341 LOG(isolate, 4310 LOG(isolate,
4342 ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index)); 4311 ApiIndexedPropertyAccess("interceptor-indexed-get-has", this, index));
4343 v8::Handle<v8::Value> result; 4312 v8::Handle<v8::Value> result = args.Call(getter, index);
4344 {
4345 // Leaving JavaScript.
4346 VMState<EXTERNAL> state(isolate);
4347 result = args.Call(getter, index);
4348 }
4349 if (!result.IsEmpty()) return NONE; 4313 if (!result.IsEmpty()) return NONE;
4350 } 4314 }
4351 4315
4352 return holder->GetElementAttributeWithoutInterceptor( 4316 return holder->GetElementAttributeWithoutInterceptor(
4353 *hreceiver, index, continue_search); 4317 *hreceiver, index, continue_search);
4354 } 4318 }
4355 4319
4356 4320
4357 PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor( 4321 PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor(
4358 JSReceiver* receiver, uint32_t index, bool continue_search) { 4322 JSReceiver* receiver, uint32_t index, bool continue_search) {
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
5008 HandleScope scope(isolate); 4972 HandleScope scope(isolate);
5009 Handle<InterceptorInfo> interceptor(GetNamedInterceptor()); 4973 Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
5010 Handle<String> name_handle(String::cast(name)); 4974 Handle<String> name_handle(String::cast(name));
5011 Handle<JSObject> this_handle(this); 4975 Handle<JSObject> this_handle(this);
5012 if (!interceptor->deleter()->IsUndefined()) { 4976 if (!interceptor->deleter()->IsUndefined()) {
5013 v8::NamedPropertyDeleter deleter = 4977 v8::NamedPropertyDeleter deleter =
5014 v8::ToCData<v8::NamedPropertyDeleter>(interceptor->deleter()); 4978 v8::ToCData<v8::NamedPropertyDeleter>(interceptor->deleter());
5015 LOG(isolate, 4979 LOG(isolate,
5016 ApiNamedPropertyAccess("interceptor-named-delete", *this_handle, name)); 4980 ApiNamedPropertyAccess("interceptor-named-delete", *this_handle, name));
5017 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); 4981 PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
5018 v8::Handle<v8::Boolean> result; 4982 v8::Handle<v8::Boolean> result =
5019 { 4983 args.Call(deleter, v8::Utils::ToLocal(name_handle));
5020 // Leaving JavaScript.
5021 VMState<EXTERNAL> state(isolate);
5022 result = args.Call(deleter, v8::Utils::ToLocal(name_handle));
5023 }
5024 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 4984 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
5025 if (!result.IsEmpty()) { 4985 if (!result.IsEmpty()) {
5026 ASSERT(result->IsBoolean()); 4986 ASSERT(result->IsBoolean());
5027 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 4987 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
5028 result_internal->VerifyApiCallResultType(); 4988 result_internal->VerifyApiCallResultType();
5029 return *result_internal; 4989 return *result_internal;
5030 } 4990 }
5031 } 4991 }
5032 MaybeObject* raw_result = 4992 MaybeObject* raw_result =
5033 this_handle->DeletePropertyPostInterceptor(*name_handle, NORMAL_DELETION); 4993 this_handle->DeletePropertyPostInterceptor(*name_handle, NORMAL_DELETION);
(...skipping 10 matching lines...) Expand all
5044 AssertNoContextChange ncc; 5004 AssertNoContextChange ncc;
5045 HandleScope scope(isolate); 5005 HandleScope scope(isolate);
5046 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); 5006 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor());
5047 if (interceptor->deleter()->IsUndefined()) return heap->false_value(); 5007 if (interceptor->deleter()->IsUndefined()) return heap->false_value();
5048 v8::IndexedPropertyDeleter deleter = 5008 v8::IndexedPropertyDeleter deleter =
5049 v8::ToCData<v8::IndexedPropertyDeleter>(interceptor->deleter()); 5009 v8::ToCData<v8::IndexedPropertyDeleter>(interceptor->deleter());
5050 Handle<JSObject> this_handle(this); 5010 Handle<JSObject> this_handle(this);
5051 LOG(isolate, 5011 LOG(isolate,
5052 ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index)); 5012 ApiIndexedPropertyAccess("interceptor-indexed-delete", this, index));
5053 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); 5013 PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
5054 v8::Handle<v8::Boolean> result; 5014 v8::Handle<v8::Boolean> result = args.Call(deleter, index);
5055 {
5056 // Leaving JavaScript.
5057 VMState<EXTERNAL> state(isolate);
5058 result = args.Call(deleter, index);
5059 }
5060 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 5015 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
5061 if (!result.IsEmpty()) { 5016 if (!result.IsEmpty()) {
5062 ASSERT(result->IsBoolean()); 5017 ASSERT(result->IsBoolean());
5063 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 5018 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
5064 result_internal->VerifyApiCallResultType(); 5019 result_internal->VerifyApiCallResultType();
5065 return *result_internal; 5020 return *result_internal;
5066 } 5021 }
5067 MaybeObject* raw_result = this_handle->GetElementsAccessor()->Delete( 5022 MaybeObject* raw_result = this_handle->GetElementsAccessor()->Delete(
5068 *this_handle, 5023 *this_handle,
5069 index, 5024 index,
(...skipping 6387 matching lines...) Expand 10 before | Expand all | Expand 10 after
11457 HandleScope scope(isolate); 11412 HandleScope scope(isolate);
11458 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor()); 11413 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor());
11459 Handle<JSObject> this_handle(this); 11414 Handle<JSObject> this_handle(this);
11460 Handle<Object> value_handle(value, isolate); 11415 Handle<Object> value_handle(value, isolate);
11461 if (!interceptor->setter()->IsUndefined()) { 11416 if (!interceptor->setter()->IsUndefined()) {
11462 v8::IndexedPropertySetter setter = 11417 v8::IndexedPropertySetter setter =
11463 v8::ToCData<v8::IndexedPropertySetter>(interceptor->setter()); 11418 v8::ToCData<v8::IndexedPropertySetter>(interceptor->setter());
11464 LOG(isolate, 11419 LOG(isolate,
11465 ApiIndexedPropertyAccess("interceptor-indexed-set", this, index)); 11420 ApiIndexedPropertyAccess("interceptor-indexed-set", this, index));
11466 PropertyCallbackArguments args(isolate, interceptor->data(), this, this); 11421 PropertyCallbackArguments args(isolate, interceptor->data(), this, this);
11467 v8::Handle<v8::Value> result; 11422 v8::Handle<v8::Value> result =
11468 { 11423 args.Call(setter, index, v8::Utils::ToLocal(value_handle));
11469 // Leaving JavaScript.
11470 VMState<EXTERNAL> state(isolate);
11471 result = args.Call(setter, index, v8::Utils::ToLocal(value_handle));
11472 }
11473 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 11424 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
11474 if (!result.IsEmpty()) return *value_handle; 11425 if (!result.IsEmpty()) return *value_handle;
11475 } 11426 }
11476 MaybeObject* raw_result = 11427 MaybeObject* raw_result =
11477 this_handle->SetElementWithoutInterceptor(index, 11428 this_handle->SetElementWithoutInterceptor(index,
11478 *value_handle, 11429 *value_handle,
11479 attributes, 11430 attributes,
11480 strict_mode, 11431 strict_mode,
11481 check_prototype, 11432 check_prototype,
11482 set_mode); 11433 set_mode);
(...skipping 17 matching lines...) Expand all
11500 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj); 11451 v8::AccessorGetter call_fun = v8::ToCData<v8::AccessorGetter>(fun_obj);
11501 if (call_fun == NULL) return isolate->heap()->undefined_value(); 11452 if (call_fun == NULL) return isolate->heap()->undefined_value();
11502 HandleScope scope(isolate); 11453 HandleScope scope(isolate);
11503 Handle<JSObject> self(JSObject::cast(receiver)); 11454 Handle<JSObject> self(JSObject::cast(receiver));
11504 Handle<JSObject> holder_handle(JSObject::cast(holder)); 11455 Handle<JSObject> holder_handle(JSObject::cast(holder));
11505 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 11456 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
11506 Handle<String> key = isolate->factory()->NumberToString(number); 11457 Handle<String> key = isolate->factory()->NumberToString(number);
11507 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key)); 11458 LOG(isolate, ApiNamedPropertyAccess("load", *self, *key));
11508 PropertyCallbackArguments 11459 PropertyCallbackArguments
11509 args(isolate, data->data(), *self, *holder_handle); 11460 args(isolate, data->data(), *self, *holder_handle);
11510 v8::Handle<v8::Value> result; 11461 v8::Handle<v8::Value> result = args.Call(call_fun, v8::Utils::ToLocal(key));
11511 {
11512 // Leaving JavaScript.
11513 VMState<EXTERNAL> state(isolate);
11514 result = args.Call(call_fun, v8::Utils::ToLocal(key));
11515 }
11516 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 11462 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
11517 if (result.IsEmpty()) return isolate->heap()->undefined_value(); 11463 if (result.IsEmpty()) return isolate->heap()->undefined_value();
11518 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 11464 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
11519 result_internal->VerifyApiCallResultType(); 11465 result_internal->VerifyApiCallResultType();
11520 return *result_internal; 11466 return *result_internal;
11521 } 11467 }
11522 11468
11523 // __defineGetter__ callback 11469 // __defineGetter__ callback
11524 if (structure->IsAccessorPair()) { 11470 if (structure->IsAccessorPair()) {
11525 Object* getter = AccessorPair::cast(structure)->getter(); 11471 Object* getter = AccessorPair::cast(structure)->getter();
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
11567 Handle<ExecutableAccessorInfo> data( 11513 Handle<ExecutableAccessorInfo> data(
11568 ExecutableAccessorInfo::cast(structure)); 11514 ExecutableAccessorInfo::cast(structure));
11569 Object* call_obj = data->setter(); 11515 Object* call_obj = data->setter();
11570 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj); 11516 v8::AccessorSetter call_fun = v8::ToCData<v8::AccessorSetter>(call_obj);
11571 if (call_fun == NULL) return value; 11517 if (call_fun == NULL) return value;
11572 Handle<Object> number = isolate->factory()->NewNumberFromUint(index); 11518 Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
11573 Handle<String> key(isolate->factory()->NumberToString(number)); 11519 Handle<String> key(isolate->factory()->NumberToString(number));
11574 LOG(isolate, ApiNamedPropertyAccess("store", *self, *key)); 11520 LOG(isolate, ApiNamedPropertyAccess("store", *self, *key));
11575 PropertyCallbackArguments 11521 PropertyCallbackArguments
11576 args(isolate, data->data(), *self, *holder_handle); 11522 args(isolate, data->data(), *self, *holder_handle);
11577 { 11523 args.Call(call_fun,
11578 // Leaving JavaScript. 11524 v8::Utils::ToLocal(key),
11579 VMState<EXTERNAL> state(isolate); 11525 v8::Utils::ToLocal(value_handle));
11580 args.Call(call_fun,
11581 v8::Utils::ToLocal(key),
11582 v8::Utils::ToLocal(value_handle));
11583 }
11584 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 11526 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
11585 return *value_handle; 11527 return *value_handle;
11586 } 11528 }
11587 11529
11588 if (structure->IsAccessorPair()) { 11530 if (structure->IsAccessorPair()) {
11589 Handle<Object> setter(AccessorPair::cast(structure)->setter(), isolate); 11531 Handle<Object> setter(AccessorPair::cast(structure)->setter(), isolate);
11590 if (setter->IsSpecFunction()) { 11532 if (setter->IsSpecFunction()) {
11591 // TODO(rossberg): nicer would be to cast to some JSCallable here... 11533 // TODO(rossberg): nicer would be to cast to some JSCallable here...
11592 return SetPropertyWithDefinedSetter(JSReceiver::cast(*setter), value); 11534 return SetPropertyWithDefinedSetter(JSReceiver::cast(*setter), value);
11593 } else { 11535 } else {
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
12473 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor(), isolate); 12415 Handle<InterceptorInfo> interceptor(GetIndexedInterceptor(), isolate);
12474 Handle<Object> this_handle(receiver, isolate); 12416 Handle<Object> this_handle(receiver, isolate);
12475 Handle<JSObject> holder_handle(this, isolate); 12417 Handle<JSObject> holder_handle(this, isolate);
12476 if (!interceptor->getter()->IsUndefined()) { 12418 if (!interceptor->getter()->IsUndefined()) {
12477 v8::IndexedPropertyGetter getter = 12419 v8::IndexedPropertyGetter getter =
12478 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter()); 12420 v8::ToCData<v8::IndexedPropertyGetter>(interceptor->getter());
12479 LOG(isolate, 12421 LOG(isolate,
12480 ApiIndexedPropertyAccess("interceptor-indexed-get", this, index)); 12422 ApiIndexedPropertyAccess("interceptor-indexed-get", this, index));
12481 PropertyCallbackArguments 12423 PropertyCallbackArguments
12482 args(isolate, interceptor->data(), receiver, this); 12424 args(isolate, interceptor->data(), receiver, this);
12483 v8::Handle<v8::Value> result; 12425 v8::Handle<v8::Value> result = args.Call(getter, index);
12484 {
12485 // Leaving JavaScript.
12486 VMState<EXTERNAL> state(isolate);
12487 result = args.Call(getter, index);
12488 }
12489 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 12426 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
12490 if (!result.IsEmpty()) { 12427 if (!result.IsEmpty()) {
12491 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 12428 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
12492 result_internal->VerifyApiCallResultType(); 12429 result_internal->VerifyApiCallResultType();
12493 return *result_internal; 12430 return *result_internal;
12494 } 12431 }
12495 } 12432 }
12496 12433
12497 Heap* heap = holder_handle->GetHeap(); 12434 Heap* heap = holder_handle->GetHeap();
12498 ElementsAccessor* handler = holder_handle->GetElementsAccessor(); 12435 ElementsAccessor* handler = holder_handle->GetElementsAccessor();
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
12783 Handle<JSObject> holder_handle(this); 12720 Handle<JSObject> holder_handle(this);
12784 Handle<String> name_handle(String::cast(name)); 12721 Handle<String> name_handle(String::cast(name));
12785 12722
12786 if (!interceptor->getter()->IsUndefined()) { 12723 if (!interceptor->getter()->IsUndefined()) {
12787 v8::NamedPropertyGetter getter = 12724 v8::NamedPropertyGetter getter =
12788 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); 12725 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter());
12789 LOG(isolate, 12726 LOG(isolate,
12790 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); 12727 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name));
12791 PropertyCallbackArguments 12728 PropertyCallbackArguments
12792 args(isolate, interceptor->data(), receiver, this); 12729 args(isolate, interceptor->data(), receiver, this);
12793 v8::Handle<v8::Value> result; 12730 v8::Handle<v8::Value> result =
12794 { 12731 args.Call(getter, v8::Utils::ToLocal(name_handle));
12795 // Leaving JavaScript.
12796 VMState<EXTERNAL> state(isolate);
12797 result = args.Call(getter, v8::Utils::ToLocal(name_handle));
12798 }
12799 RETURN_IF_SCHEDULED_EXCEPTION(isolate); 12732 RETURN_IF_SCHEDULED_EXCEPTION(isolate);
12800 if (!result.IsEmpty()) { 12733 if (!result.IsEmpty()) {
12801 *attributes = NONE; 12734 *attributes = NONE;
12802 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); 12735 Handle<Object> result_internal = v8::Utils::OpenHandle(*result);
12803 result_internal->VerifyApiCallResultType(); 12736 result_internal->VerifyApiCallResultType();
12804 return *result_internal; 12737 return *result_internal;
12805 } 12738 }
12806 } 12739 }
12807 12740
12808 MaybeObject* result = holder_handle->GetPropertyPostInterceptor( 12741 MaybeObject* result = holder_handle->GetPropertyPostInterceptor(
(...skipping 3007 matching lines...) Expand 10 before | Expand all | Expand 10 after
15816 return static_cast<Type*>(type_raw()); 15749 return static_cast<Type*>(type_raw());
15817 } 15750 }
15818 15751
15819 15752
15820 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { 15753 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
15821 set_type_raw(type, ignored); 15754 set_type_raw(type, ignored);
15822 } 15755 }
15823 15756
15824 15757
15825 } } // namespace v8::internal 15758 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698