OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 155 |
156 LoadStubCompiler compiler(isolate_); | 156 LoadStubCompiler compiler(isolate_); |
157 Handle<Code> code = compiler.CompileLoadField(receiver, holder, name, field); | 157 Handle<Code> code = compiler.CompileLoadField(receiver, holder, name, field); |
158 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); | 158 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
159 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 159 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
160 JSObject::UpdateMapCodeCache(map_holder, name, code); | 160 JSObject::UpdateMapCodeCache(map_holder, name, code); |
161 return code; | 161 return code; |
162 } | 162 } |
163 | 163 |
164 | 164 |
165 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name, | 165 Handle<Code> StubCache::ComputeLoadCallback( |
166 Handle<JSObject> receiver, | 166 Handle<String> name, |
167 Handle<JSObject> holder, | 167 Handle<JSObject> receiver, |
168 Handle<AccessorInfo> callback) { | 168 Handle<JSObject> holder, |
| 169 Handle<ExecutableAccessorInfo> callback) { |
169 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); | 170 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); |
170 InlineCacheHolderFlag cache_holder = | 171 InlineCacheHolderFlag cache_holder = |
171 IC::GetCodeCacheForObject(*receiver, *holder); | 172 IC::GetCodeCacheForObject(*receiver, *holder); |
172 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); | 173 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); |
173 Code::Flags flags = | 174 Code::Flags flags = |
174 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); | 175 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); |
175 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), | 176 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), |
176 isolate_); | 177 isolate_); |
177 if (probe->IsCode()) return Handle<Code>::cast(probe); | 178 if (probe->IsCode()) return Handle<Code>::cast(probe); |
178 | 179 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 347 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
347 JSObject::UpdateMapCodeCache(map_holder, name, code); | 348 JSObject::UpdateMapCodeCache(map_holder, name, code); |
348 return code; | 349 return code; |
349 } | 350 } |
350 | 351 |
351 | 352 |
352 Handle<Code> StubCache::ComputeKeyedLoadCallback( | 353 Handle<Code> StubCache::ComputeKeyedLoadCallback( |
353 Handle<String> name, | 354 Handle<String> name, |
354 Handle<JSObject> receiver, | 355 Handle<JSObject> receiver, |
355 Handle<JSObject> holder, | 356 Handle<JSObject> holder, |
356 Handle<AccessorInfo> callback) { | 357 Handle<ExecutableAccessorInfo> callback) { |
357 InlineCacheHolderFlag cache_holder = | 358 InlineCacheHolderFlag cache_holder = |
358 IC::GetCodeCacheForObject(*receiver, *holder); | 359 IC::GetCodeCacheForObject(*receiver, *holder); |
359 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); | 360 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); |
360 Code::Flags flags = | 361 Code::Flags flags = |
361 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); | 362 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); |
362 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), | 363 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), |
363 isolate_); | 364 isolate_); |
364 if (probe->IsCode()) return Handle<Code>::cast(probe); | 365 if (probe->IsCode()) return Handle<Code>::cast(probe); |
365 | 366 |
366 KeyedLoadStubCompiler compiler(isolate_); | 367 KeyedLoadStubCompiler compiler(isolate_); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 463 |
463 StoreStubCompiler compiler(isolate_, strict_mode); | 464 StoreStubCompiler compiler(isolate_, strict_mode); |
464 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); | 465 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); |
465 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 466 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
466 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 467 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
467 JSObject::UpdateMapCodeCache(receiver, name, code); | 468 JSObject::UpdateMapCodeCache(receiver, name, code); |
468 return code; | 469 return code; |
469 } | 470 } |
470 | 471 |
471 | 472 |
472 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name, | 473 Handle<Code> StubCache::ComputeStoreCallback( |
473 Handle<JSObject> receiver, | 474 Handle<String> name, |
474 Handle<JSObject> holder, | 475 Handle<JSObject> receiver, |
475 Handle<AccessorInfo> callback, | 476 Handle<JSObject> holder, |
476 StrictModeFlag strict_mode) { | 477 Handle<ExecutableAccessorInfo> callback, |
| 478 StrictModeFlag strict_mode) { |
477 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 479 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
478 Code::Flags flags = Code::ComputeMonomorphicFlags( | 480 Code::Flags flags = Code::ComputeMonomorphicFlags( |
479 Code::STORE_IC, Code::CALLBACKS, strict_mode); | 481 Code::STORE_IC, Code::CALLBACKS, strict_mode); |
480 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), | 482 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
481 isolate_); | 483 isolate_); |
482 if (probe->IsCode()) return Handle<Code>::cast(probe); | 484 if (probe->IsCode()) return Handle<Code>::cast(probe); |
483 | 485 |
484 StoreStubCompiler compiler(isolate_, strict_mode); | 486 StoreStubCompiler compiler(isolate_, strict_mode); |
485 Handle<Code> code = | 487 Handle<Code> code = |
486 compiler.CompileStoreCallback(name, receiver, holder, callback); | 488 compiler.CompileStoreCallback(name, receiver, holder, callback); |
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 | 991 |
990 | 992 |
991 // ------------------------------------------------------------------------ | 993 // ------------------------------------------------------------------------ |
992 // StubCompiler implementation. | 994 // StubCompiler implementation. |
993 | 995 |
994 | 996 |
995 RUNTIME_FUNCTION(MaybeObject*, LoadCallbackProperty) { | 997 RUNTIME_FUNCTION(MaybeObject*, LoadCallbackProperty) { |
996 ASSERT(args[0]->IsJSObject()); | 998 ASSERT(args[0]->IsJSObject()); |
997 ASSERT(args[1]->IsJSObject()); | 999 ASSERT(args[1]->IsJSObject()); |
998 ASSERT(args[3]->IsSmi()); | 1000 ASSERT(args[3]->IsSmi()); |
999 AccessorInfo* callback = AccessorInfo::cast(args[4]); | 1001 ExecutableAccessorInfo* callback = ExecutableAccessorInfo::cast(args[4]); |
1000 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1002 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1001 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); | 1003 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); |
1002 ASSERT(fun != NULL); | 1004 ASSERT(fun != NULL); |
1003 ASSERT(callback->IsCompatibleReceiver(args[0])); | 1005 ASSERT(callback->IsCompatibleReceiver(args[0])); |
1004 v8::AccessorInfo info(&args[0]); | 1006 v8::AccessorInfo info(&args[0]); |
1005 HandleScope scope(isolate); | 1007 HandleScope scope(isolate); |
1006 v8::Handle<v8::Value> result; | 1008 v8::Handle<v8::Value> result; |
1007 { | 1009 { |
1008 // Leaving JavaScript. | 1010 // Leaving JavaScript. |
1009 VMState state(isolate, EXTERNAL); | 1011 VMState state(isolate, EXTERNAL); |
1010 ExternalCallbackScope call_scope(isolate, getter_address); | 1012 ExternalCallbackScope call_scope(isolate, getter_address); |
1011 result = fun(v8::Utils::ToLocal(args.at<String>(5)), info); | 1013 result = fun(v8::Utils::ToLocal(args.at<String>(5)), info); |
1012 } | 1014 } |
1013 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1015 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
1014 if (result.IsEmpty()) return HEAP->undefined_value(); | 1016 if (result.IsEmpty()) return HEAP->undefined_value(); |
1015 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | 1017 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
1016 result_internal->VerifyApiCallResultType(); | 1018 result_internal->VerifyApiCallResultType(); |
1017 return *result_internal; | 1019 return *result_internal; |
1018 } | 1020 } |
1019 | 1021 |
1020 | 1022 |
1021 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { | 1023 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { |
1022 JSObject* recv = JSObject::cast(args[0]); | 1024 JSObject* recv = JSObject::cast(args[0]); |
1023 AccessorInfo* callback = AccessorInfo::cast(args[1]); | 1025 ExecutableAccessorInfo* callback = ExecutableAccessorInfo::cast(args[1]); |
1024 Address setter_address = v8::ToCData<Address>(callback->setter()); | 1026 Address setter_address = v8::ToCData<Address>(callback->setter()); |
1025 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); | 1027 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); |
1026 ASSERT(fun != NULL); | 1028 ASSERT(fun != NULL); |
1027 ASSERT(callback->IsCompatibleReceiver(recv)); | 1029 ASSERT(callback->IsCompatibleReceiver(recv)); |
1028 Handle<String> name = args.at<String>(2); | 1030 Handle<String> name = args.at<String>(2); |
1029 Handle<Object> value = args.at<Object>(3); | 1031 Handle<Object> value = args.at<Object>(3); |
1030 HandleScope scope(isolate); | 1032 HandleScope scope(isolate); |
1031 LOG(isolate, ApiNamedPropertyAccess("store", recv, *name)); | 1033 LOG(isolate, ApiNamedPropertyAccess("store", recv, *name)); |
1032 CustomArguments custom_args(isolate, callback->data(), recv, recv); | 1034 CustomArguments custom_args(isolate, callback->data(), recv, recv); |
1033 v8::AccessorInfo info(custom_args.end()); | 1035 v8::AccessorInfo info(custom_args.end()); |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 | 1402 |
1401 // Return the generated code. | 1403 // Return the generated code. |
1402 return GetCode(Code::FIELD, name); | 1404 return GetCode(Code::FIELD, name); |
1403 } | 1405 } |
1404 | 1406 |
1405 | 1407 |
1406 Handle<Code> BaseLoadStubCompiler::CompileLoadCallback( | 1408 Handle<Code> BaseLoadStubCompiler::CompileLoadCallback( |
1407 Handle<JSObject> object, | 1409 Handle<JSObject> object, |
1408 Handle<JSObject> holder, | 1410 Handle<JSObject> holder, |
1409 Handle<String> name, | 1411 Handle<String> name, |
1410 Handle<AccessorInfo> callback) { | 1412 Handle<ExecutableAccessorInfo> callback) { |
1411 Label miss; | 1413 Label miss; |
1412 | 1414 |
1413 GenerateNameCheck(name, this->name(), &miss); | 1415 GenerateNameCheck(name, this->name(), &miss); |
1414 GenerateLoadCallback(object, holder, receiver(), this->name(), | 1416 GenerateLoadCallback(object, holder, receiver(), this->name(), |
1415 scratch1(), scratch2(), scratch3(), scratch4(), | 1417 scratch1(), scratch2(), scratch3(), scratch4(), |
1416 callback, name, &miss); | 1418 callback, name, &miss); |
1417 __ bind(&miss); | 1419 __ bind(&miss); |
1418 GenerateLoadMiss(masm(), kind()); | 1420 GenerateLoadMiss(masm(), kind()); |
1419 | 1421 |
1420 // Return the generated code. | 1422 // Return the generated code. |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 Handle<FunctionTemplateInfo>( | 1756 Handle<FunctionTemplateInfo>( |
1755 FunctionTemplateInfo::cast(signature->receiver())); | 1757 FunctionTemplateInfo::cast(signature->receiver())); |
1756 } | 1758 } |
1757 } | 1759 } |
1758 | 1760 |
1759 is_simple_api_call_ = true; | 1761 is_simple_api_call_ = true; |
1760 } | 1762 } |
1761 | 1763 |
1762 | 1764 |
1763 } } // namespace v8::internal | 1765 } } // namespace v8::internal |
OLD | NEW |