| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 385 } |
| 386 __ mov(dst, FieldOperand(src, offset)); | 386 __ mov(dst, FieldOperand(src, offset)); |
| 387 } | 387 } |
| 388 | 388 |
| 389 | 389 |
| 390 static void PushInterceptorArguments(MacroAssembler* masm, | 390 static void PushInterceptorArguments(MacroAssembler* masm, |
| 391 Register receiver, | 391 Register receiver, |
| 392 Register holder, | 392 Register holder, |
| 393 Register name, | 393 Register name, |
| 394 Handle<JSObject> holder_obj) { | 394 Handle<JSObject> holder_obj) { |
| 395 STATIC_ASSERT(StubCache::kInterceptorArgsNameIndex == 0); | |
| 396 STATIC_ASSERT(StubCache::kInterceptorArgsInfoIndex == 1); | |
| 397 STATIC_ASSERT(StubCache::kInterceptorArgsThisIndex == 2); | |
| 398 STATIC_ASSERT(StubCache::kInterceptorArgsHolderIndex == 3); | |
| 399 STATIC_ASSERT(StubCache::kInterceptorArgsLength == 4); | |
| 400 __ push(name); | 395 __ push(name); |
| 401 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); | 396 Handle<InterceptorInfo> interceptor(holder_obj->GetNamedInterceptor()); |
| 402 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); | 397 ASSERT(!masm->isolate()->heap()->InNewSpace(*interceptor)); |
| 403 Register scratch = name; | 398 Register scratch = name; |
| 404 __ mov(scratch, Immediate(interceptor)); | 399 __ mov(scratch, Immediate(interceptor)); |
| 405 __ push(scratch); | 400 __ push(scratch); |
| 406 __ push(receiver); | 401 __ push(receiver); |
| 407 __ push(holder); | 402 __ push(holder); |
| 403 __ push(FieldOperand(scratch, InterceptorInfo::kDataOffset)); |
| 404 __ push(Immediate(reinterpret_cast<int>(masm->isolate()))); |
| 408 } | 405 } |
| 409 | 406 |
| 410 | 407 |
| 411 static void CompileCallLoadPropertyWithInterceptor( | 408 static void CompileCallLoadPropertyWithInterceptor( |
| 412 MacroAssembler* masm, | 409 MacroAssembler* masm, |
| 413 Register receiver, | 410 Register receiver, |
| 414 Register holder, | 411 Register holder, |
| 415 Register name, | 412 Register name, |
| 416 Handle<JSObject> holder_obj) { | 413 Handle<JSObject> holder_obj) { |
| 417 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); | 414 PushInterceptorArguments(masm, receiver, holder, name, holder_obj); |
| 418 __ CallExternalReference( | 415 __ CallExternalReference( |
| 419 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), | 416 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorOnly), |
| 420 masm->isolate()), | 417 masm->isolate()), |
| 421 StubCache::kInterceptorArgsLength); | 418 6); |
| 422 } | 419 } |
| 423 | 420 |
| 424 | 421 |
| 425 // Number of pointers to be reserved on stack for fast API call. | 422 // Number of pointers to be reserved on stack for fast API call. |
| 426 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; | 423 static const int kFastApiCallArguments = FunctionCallbackArguments::kArgsLength; |
| 427 | 424 |
| 428 | 425 |
| 429 // Reserves space for the extra arguments to API function in the | 426 // Reserves space for the extra arguments to API function in the |
| 430 // caller's frame. | 427 // caller's frame. |
| 431 // | 428 // |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 | 726 |
| 730 FrameScope scope(masm, StackFrame::INTERNAL); | 727 FrameScope scope(masm, StackFrame::INTERNAL); |
| 731 // Save the name_ register across the call. | 728 // Save the name_ register across the call. |
| 732 __ push(name_); | 729 __ push(name_); |
| 733 | 730 |
| 734 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); | 731 PushInterceptorArguments(masm, receiver, holder, name_, interceptor_holder); |
| 735 | 732 |
| 736 __ CallExternalReference( | 733 __ CallExternalReference( |
| 737 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), | 734 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForCall), |
| 738 masm->isolate()), | 735 masm->isolate()), |
| 739 StubCache::kInterceptorArgsLength); | 736 6); |
| 740 | 737 |
| 741 // Restore the name_ register. | 738 // Restore the name_ register. |
| 742 __ pop(name_); | 739 __ pop(name_); |
| 743 | 740 |
| 744 // Leave the internal frame. | 741 // Leave the internal frame. |
| 745 } | 742 } |
| 746 | 743 |
| 747 void LoadWithInterceptor(MacroAssembler* masm, | 744 void LoadWithInterceptor(MacroAssembler* masm, |
| 748 Register receiver, | 745 Register receiver, |
| 749 Register holder, | 746 Register holder, |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1397 } | 1394 } |
| 1398 | 1395 |
| 1399 | 1396 |
| 1400 void BaseLoadStubCompiler::GenerateLoadCallback( | 1397 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1401 Register reg, | 1398 Register reg, |
| 1402 Handle<ExecutableAccessorInfo> callback) { | 1399 Handle<ExecutableAccessorInfo> callback) { |
| 1403 // Insert additional parameters into the stack frame above return address. | 1400 // Insert additional parameters into the stack frame above return address. |
| 1404 ASSERT(!scratch3().is(reg)); | 1401 ASSERT(!scratch3().is(reg)); |
| 1405 __ pop(scratch3()); // Get return address to place it below. | 1402 __ pop(scratch3()); // Get return address to place it below. |
| 1406 | 1403 |
| 1407 STATIC_ASSERT(PropertyCallbackArguments::kThisIndex == 0); | |
| 1408 STATIC_ASSERT(PropertyCallbackArguments::kDataIndex == -1); | |
| 1409 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueOffset == -2); | |
| 1410 STATIC_ASSERT(PropertyCallbackArguments::kReturnValueDefaultValueIndex == -3); | |
| 1411 STATIC_ASSERT(PropertyCallbackArguments::kIsolateIndex == -4); | |
| 1412 STATIC_ASSERT(PropertyCallbackArguments::kHolderIndex == -5); | |
| 1413 __ push(receiver()); // receiver | 1404 __ push(receiver()); // receiver |
| 1414 __ mov(scratch2(), esp); | 1405 __ mov(scratch2(), esp); |
| 1415 ASSERT(!scratch2().is(reg)); | 1406 ASSERT(!scratch2().is(reg)); |
| 1407 __ push(reg); // holder |
| 1416 // Push data from ExecutableAccessorInfo. | 1408 // Push data from ExecutableAccessorInfo. |
| 1417 if (isolate()->heap()->InNewSpace(callback->data())) { | 1409 if (isolate()->heap()->InNewSpace(callback->data())) { |
| 1418 ASSERT(!scratch1().is(reg)); | |
| 1419 __ mov(scratch1(), Immediate(callback)); | 1410 __ mov(scratch1(), Immediate(callback)); |
| 1420 __ push(FieldOperand(scratch1(), ExecutableAccessorInfo::kDataOffset)); | 1411 __ push(FieldOperand(scratch1(), ExecutableAccessorInfo::kDataOffset)); |
| 1421 } else { | 1412 } else { |
| 1422 __ push(Immediate(Handle<Object>(callback->data(), isolate()))); | 1413 __ push(Immediate(Handle<Object>(callback->data(), isolate()))); |
| 1423 } | 1414 } |
| 1424 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue | 1415 __ push(Immediate(isolate()->factory()->undefined_value())); // ReturnValue |
| 1425 // ReturnValue default value | 1416 // ReturnValue default value |
| 1426 __ push(Immediate(isolate()->factory()->undefined_value())); | 1417 __ push(Immediate(isolate()->factory()->undefined_value())); |
| 1427 __ push(Immediate(reinterpret_cast<int>(isolate()))); | 1418 __ push(Immediate(reinterpret_cast<int>(isolate()))); |
| 1428 __ push(reg); // holder | |
| 1429 | 1419 |
| 1430 // Save a pointer to where we pushed the arguments pointer. This will be | 1420 // Save a pointer to where we pushed the arguments pointer. This will be |
| 1431 // passed as the const ExecutableAccessorInfo& to the C++ callback. | 1421 // passed as the const ExecutableAccessorInfo& to the C++ callback. |
| 1432 __ push(scratch2()); | 1422 __ push(scratch2()); |
| 1433 | 1423 |
| 1434 __ push(name()); // name | 1424 __ push(name()); // name |
| 1435 __ mov(ebx, esp); // esp points to reference to name (handler). | 1425 __ mov(ebx, esp); // esp points to reference to name (handler). |
| 1436 | 1426 |
| 1437 __ push(scratch3()); // Restore return address. | 1427 __ push(scratch3()); // Restore return address. |
| 1438 | 1428 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1453 // already generated). Do not allow the assembler to perform a | 1443 // already generated). Do not allow the assembler to perform a |
| 1454 // garbage collection but instead return the allocation failure | 1444 // garbage collection but instead return the allocation failure |
| 1455 // object. | 1445 // object. |
| 1456 | 1446 |
| 1457 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); | 1447 Address thunk_address = FUNCTION_ADDR(&InvokeAccessorGetterCallback); |
| 1458 | 1448 |
| 1459 __ CallApiFunctionAndReturn(getter_address, | 1449 __ CallApiFunctionAndReturn(getter_address, |
| 1460 thunk_address, | 1450 thunk_address, |
| 1461 ApiParameterOperand(2), | 1451 ApiParameterOperand(2), |
| 1462 kStackSpace, | 1452 kStackSpace, |
| 1463 7); | 1453 6); |
| 1464 } | 1454 } |
| 1465 | 1455 |
| 1466 | 1456 |
| 1467 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1457 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 1468 // Return the constant value. | 1458 // Return the constant value. |
| 1469 __ LoadObject(eax, value); | 1459 __ LoadObject(eax, value); |
| 1470 __ ret(0); | 1460 __ ret(0); |
| 1471 } | 1461 } |
| 1472 | 1462 |
| 1473 | 1463 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 // Call the runtime system to load the interceptor. | 1550 // Call the runtime system to load the interceptor. |
| 1561 // Check that the maps haven't changed. | 1551 // Check that the maps haven't changed. |
| 1562 __ pop(scratch2()); // save old return address | 1552 __ pop(scratch2()); // save old return address |
| 1563 PushInterceptorArguments(masm(), receiver(), holder_reg, | 1553 PushInterceptorArguments(masm(), receiver(), holder_reg, |
| 1564 this->name(), interceptor_holder); | 1554 this->name(), interceptor_holder); |
| 1565 __ push(scratch2()); // restore old return address | 1555 __ push(scratch2()); // restore old return address |
| 1566 | 1556 |
| 1567 ExternalReference ref = | 1557 ExternalReference ref = |
| 1568 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), | 1558 ExternalReference(IC_Utility(IC::kLoadPropertyWithInterceptorForLoad), |
| 1569 isolate()); | 1559 isolate()); |
| 1570 __ TailCallExternalReference(ref, StubCache::kInterceptorArgsLength, 1); | 1560 __ TailCallExternalReference(ref, 6, 1); |
| 1571 } | 1561 } |
| 1572 } | 1562 } |
| 1573 | 1563 |
| 1574 | 1564 |
| 1575 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { | 1565 void CallStubCompiler::GenerateNameCheck(Handle<Name> name, Label* miss) { |
| 1576 if (kind_ == Code::KEYED_CALL_IC) { | 1566 if (kind_ == Code::KEYED_CALL_IC) { |
| 1577 __ cmp(ecx, Immediate(name)); | 1567 __ cmp(ecx, Immediate(name)); |
| 1578 __ j(not_equal, miss); | 1568 __ j(not_equal, miss); |
| 1579 } | 1569 } |
| 1580 } | 1570 } |
| (...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3268 // ----------------------------------- | 3258 // ----------------------------------- |
| 3269 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3259 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3270 } | 3260 } |
| 3271 | 3261 |
| 3272 | 3262 |
| 3273 #undef __ | 3263 #undef __ |
| 3274 | 3264 |
| 3275 } } // namespace v8::internal | 3265 } } // namespace v8::internal |
| 3276 | 3266 |
| 3277 #endif // V8_TARGET_ARCH_IA32 | 3267 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |