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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #if V8_TARGET_ARCH_X64 | 30 #if V8_TARGET_ARCH_X64 |
31 | 31 |
32 #include "arguments.h" | |
33 #include "ic-inl.h" | 32 #include "ic-inl.h" |
34 #include "codegen.h" | 33 #include "codegen.h" |
35 #include "stub-cache.h" | 34 #include "stub-cache.h" |
36 | 35 |
37 namespace v8 { | 36 namespace v8 { |
38 namespace internal { | 37 namespace internal { |
39 | 38 |
40 #define __ ACCESS_MASM(masm) | 39 #define __ ACCESS_MASM(masm) |
41 | 40 |
42 | 41 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 359 } |
361 __ movq(dst, FieldOperand(src, offset)); | 360 __ movq(dst, FieldOperand(src, offset)); |
362 } | 361 } |
363 | 362 |
364 | 363 |
365 static void PushInterceptorArguments(MacroAssembler* masm, | 364 static void PushInterceptorArguments(MacroAssembler* masm, |
366 Register receiver, | 365 Register receiver, |
367 Register holder, | 366 Register holder, |
368 Register name, | 367 Register name, |
369 Handle<JSObject> holder_obj) { | 368 Handle<JSObject> holder_obj) { |
370 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0); | |
371 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1); | |
372 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2); | |
373 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3); | |
374 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4); | |
375 __ push(name); | 369 __ push(name); |
376 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); | 370 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); |
377 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); | 371 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); |
378 __ Move(kScratchRegister, interceptor); | 372 __ Move(kScratchRegister, interceptor); |
379 __ push(kScratchRegister); | 373 __ push(kScratchRegister); |
380 __ push(receiver); | 374 __ push(receiver); |
381 __ push(holder); | 375 __ push(holder); |
| 376 __ push(FieldOperand(kScratchRegister, InterceptorInfo::kDataOffset)); |
| 377 __ PushAddress(ExternalReference::isolate_address(masm->isolate())); |
382 } | 378 } |
383 | 379 |
384 | 380 |
385 static void CompileCallLoadPropertyWithInterceptor( | 381 static void CompileCallLoadPropertyWithInterceptor( |
386 MacroAssembler* masm, | 382 MacroAssembler* masm, |
387 Register receiver, | 383 Register receiver, |
388 Register holder, | 384 Register holder, |
389 Register name, | 385 Register name, |
390 Handle<JSObject> holder_obj) { | 386 Handle<JSObject> holder_obj) { |
391 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 387 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
392 | 388 |
393 ExternalReference ref = | 389 ExternalReference ref = |
394 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), | 390 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), |
395 masm->isolate()); | 391 masm->isolate()); |
396 __ Set(rax, StubCache::kInterceptorArgsLength); | 392 __ Set(rax, 6); |
397 __ LoadAddress(rbx, ref); | 393 __ LoadAddress(rbx, ref); |
398 | 394 |
399 CEntryStub stub(1); | 395 CEntryStub stub(1); |
400 __ CallStub(&stub); | 396 __ CallStub(&stub); |
401 } | 397 } |
402 | 398 |
403 | 399 |
404 // Number of pointers to be reserved on stack for fast API call. | 400 // Number of pointers to be reserved on stack for fast API call. |
405 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; | 401 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; |
406 | 402 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 | 712 |
717 FrameScope scope(masm, StackFrame::INTERNAL); | 713 FrameScope scope(masm, StackFrame::INTERNAL); |
718 // Save the name_ register across the call. | 714 // Save the name_ register across the call. |
719 __ push(name_); | 715 __ push(name_); |
720 | 716 |
721 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); | 717 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); |
722 | 718 |
723 __ CallExternalReference( | 719 __ CallExternalReference( |
724 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), | 720 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), |
725 masm->isolate()), | 721 masm->isolate()), |
726 StubCache::kInterceptorArgsLength); | 722 6); |
727 | 723 |
728 // Restore the name_ register. | 724 // Restore the name_ register. |
729 __ pop(name_); | 725 __ pop(name_); |
730 | 726 |
731 // Leave the internal frame. | 727 // Leave the internal frame. |
732 } | 728 } |
733 | 729 |
734 void LoadWithInterceptor(MacroAssembler* masm, | 730 void LoadWithInterceptor(MacroAssembler* masm, |
735 Register receiver, | 731 Register receiver, |
736 Register holder, | 732 Register holder, |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 } | 1315 } |
1320 | 1316 |
1321 | 1317 |
1322 void BaseLoadStubCompiler::GenerateLoadCallback( | 1318 void BaseLoadStubCompiler::GenerateLoadCallback( |
1323 Register reg, | 1319 Register reg, |
1324 Handle<ExecutableAccessorInfo> callback) { | 1320 Handle<ExecutableAccessorInfo> callback) { |
1325 // Insert additional parameters into the stack frame above return address. | 1321 // Insert additional parameters into the stack frame above return address. |
1326 ASSERT(!scratch4().is(reg)); | 1322 ASSERT(!scratch4().is(reg)); |
1327 __ PopReturnAddressTo(scratch4()); | 1323 __ PopReturnAddressTo(scratch4()); |
1328 | 1324 |
1329 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 0); | |
1330 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == -1); | |
1331 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == -2); | |
1332 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == -3); | |
1333 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == -4); | |
1334 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == -5); | |
1335 __ push(receiver()); // receiver | 1325 __ push(receiver()); // receiver |
| 1326 __ push(reg); // holder |
1336 if (heap()->InNewSpace(callback->data())) { | 1327 if (heap()->InNewSpace(callback->data())) { |
1337 ASSERT(!scratch1().is(reg)); | |
1338 __ Move(scratch1(), callback); | 1328 __ Move(scratch1(), callback); |
1339 __ push(FieldOperand(scratch1(), | 1329 __ push(FieldOperand(scratch1(), |
1340 ExecutableAccessorInfo::kDataOffset)); // data | 1330 ExecutableAccessorInfo::kDataOffset)); // data |
1341 } else { | 1331 } else { |
1342 __ Push(Handle<Object>(callback->data(), isolate())); | 1332 __ Push(Handle<Object>(callback->data(), isolate())); |
1343 } | 1333 } |
1344 ASSERT(!kScratchRegister.is(reg)); | |
1345 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); | 1334 __ LoadRoot(kScratchRegister, Heap::kUndefinedValueRootIndex); |
1346 __ push(kScratchRegister); // return value | 1335 __ push(kScratchRegister); // return value |
1347 __ push(kScratchRegister); // return value default | 1336 __ push(kScratchRegister); // return value default |
1348 __ PushAddress(ExternalReference::isolate_address(isolate())); | 1337 __ PushAddress(ExternalReference::isolate_address(isolate())); |
1349 __ push(reg); // holder | |
1350 __ push(name()); // name | 1338 __ push(name()); // name |
1351 // Save a pointer to where we pushed the arguments pointer. This will be | 1339 // Save a pointer to where we pushed the arguments pointer. This will be |
1352 // passed as the const ExecutableAccessorInfo& to the C++ callback. | 1340 // passed as the const ExecutableAccessorInfo& to the C++ callback. |
1353 | 1341 |
1354 Address getter_address = v8::ToCData<Address>(callback->getter()); | 1342 Address getter_address = v8::ToCData<Address>(callback->getter()); |
1355 | 1343 |
1356 #if defined(__MINGW64__) || defined(_WIN64) | 1344 #if defined(__MINGW64__) || defined(_WIN64) |
1357 Register getter_arg = r8; | 1345 Register getter_arg = r8; |
1358 Register accessor_info_arg = rdx; | 1346 Register accessor_info_arg = rdx; |
1359 Register name_arg = rcx; | 1347 Register name_arg = rcx; |
(...skipping 23 matching lines...) Expand all Loading... |
1383 // The context register (rsi) has been saved in PrepareCallApiFunction and | 1371 // The context register (rsi) has been saved in PrepareCallApiFunction and |
1384 // could be used to pass arguments. | 1372 // could be used to pass arguments. |
1385 __ lea(accessor_info_arg, StackSpaceOperand(0)); | 1373 __ lea(accessor_info_arg, StackSpaceOperand(0)); |
1386 | 1374 |
1387 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 1375 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
1388 | 1376 |
1389 __ CallApiFunctionAndReturn(getter_address, | 1377 __ CallApiFunctionAndReturn(getter_address, |
1390 thunk_address, | 1378 thunk_address, |
1391 getter_arg, | 1379 getter_arg, |
1392 kStackSpace, | 1380 kStackSpace, |
1393 6); | 1381 5); |
1394 } | 1382 } |
1395 | 1383 |
1396 | 1384 |
1397 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1385 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
1398 // Return the constant value. | 1386 // Return the constant value. |
1399 __ LoadObject(rax, value); | 1387 __ LoadObject(rax, value); |
1400 __ ret(0); | 1388 __ ret(0); |
1401 } | 1389 } |
1402 | 1390 |
1403 | 1391 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 } else { // !compile_followup_inline | 1470 } else { // !compile_followup_inline |
1483 // Call the runtime system to load the interceptor. | 1471 // Call the runtime system to load the interceptor. |
1484 // Check that the maps haven't changed. | 1472 // Check that the maps haven't changed. |
1485 __ PopReturnAddressTo(scratch2()); | 1473 __ PopReturnAddressTo(scratch2()); |
1486 PushInterceptorArguments(masm(), receiver(), holder_reg, | 1474 PushInterceptorArguments(masm(), receiver(), holder_reg, |
1487 this->name(), interceptor_holder); | 1475 this->name(), interceptor_holder); |
1488 __ PushReturnAddressFrom(scratch2()); | 1476 __ PushReturnAddressFrom(scratch2()); |
1489 | 1477 |
1490 ExternalReference ref = ExternalReference( | 1478 ExternalReference ref = ExternalReference( |
1491 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate()); | 1479 IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), isolate()); |
1492 __ TailCallExternalReference(ref, StubCache::kInterceptorArgsLength, 1); | 1480 __ TailCallExternalReference(ref, 6, 1); |
1493 } | 1481 } |
1494 } | 1482 } |
1495 | 1483 |
1496 | 1484 |
1497 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { | 1485 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { |
1498 if (kind_ == Code::KEYED_CALL_IC) { | 1486 if (kind_ == Code::KEYED_CALL_IC) { |
1499 __ Cmp(rcx, name); | 1487 __ Cmp(rcx, name); |
1500 __ j(not_equal, miss); | 1488 __ j(not_equal, miss); |
1501 } | 1489 } |
1502 } | 1490 } |
(...skipping 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3162 // ----------------------------------- | 3150 // ----------------------------------- |
3163 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3151 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
3164 } | 3152 } |
3165 | 3153 |
3166 | 3154 |
3167 #undef __ | 3155 #undef __ |
3168 | 3156 |
3169 } } // namespace v8::internal | 3157 } } // namespace v8::internal |
3170 | 3158 |
3171 #endif // V8_TARGET_ARCH_X64 | 3159 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |