OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 | 1535 |
1536 Label non_callable, non_function, non_smi; | 1536 Label non_callable, non_function, non_smi; |
1537 __ JumpIfSmi(edi, &non_callable); | 1537 __ JumpIfSmi(edi, &non_callable); |
1538 __ bind(&non_smi); | 1538 __ bind(&non_smi); |
1539 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); | 1539 __ CmpObjectType(edi, JS_FUNCTION_TYPE, ecx); |
1540 __ j(equal, masm->isolate()->builtins()->CallFunction(mode), | 1540 __ j(equal, masm->isolate()->builtins()->CallFunction(mode), |
1541 RelocInfo::CODE_TARGET); | 1541 RelocInfo::CODE_TARGET); |
1542 __ CmpInstanceType(ecx, JS_PROXY_TYPE); | 1542 __ CmpInstanceType(ecx, JS_PROXY_TYPE); |
1543 __ j(not_equal, &non_function); | 1543 __ j(not_equal, &non_function); |
1544 | 1544 |
1545 // 1. Call to function proxy. | 1545 // 1. Runtime fallback for Proxy [[Call]]. |
1546 // TODO(neis): Implement [[Call]] on proxies. | 1546 __ PopReturnAddressTo(ecx); |
| 1547 __ Push(edi); |
| 1548 __ PushReturnAddressFrom(ecx); |
| 1549 // Increase the arguments size to include the pushed function and the |
| 1550 // existing receiver on the stack. |
| 1551 __ addp(eax, Immediate(2)); |
| 1552 // Tail-call to the runtime. |
| 1553 __ JumpToExternalReference( |
| 1554 ExternalReference(Runtime::kJSProxyCall, masm->isolate())); |
1547 | 1555 |
1548 // 2. Call to something else, which might have a [[Call]] internal method (if | 1556 // 2. Call to something else, which might have a [[Call]] internal method (if |
1549 // not we raise an exception). | 1557 // not we raise an exception). |
1550 __ bind(&non_function); | 1558 __ bind(&non_function); |
1551 // Check if target has a [[Call]] internal method. | 1559 // Check if target has a [[Call]] internal method. |
1552 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), 1 << Map::kIsCallable); | 1560 __ test_b(FieldOperand(ecx, Map::kBitFieldOffset), 1 << Map::kIsCallable); |
1553 __ j(zero, &non_callable, Label::kNear); | 1561 __ j(zero, &non_callable, Label::kNear); |
1554 // Overwrite the original receiver with the (original) target. | 1562 // Overwrite the original receiver with the (original) target. |
1555 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); | 1563 __ mov(Operand(esp, eax, times_pointer_size, kPointerSize), edi); |
1556 // Let the "call_as_function_delegate" take care of the rest. | 1564 // Let the "call_as_function_delegate" take care of the rest. |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 | 1966 |
1959 __ bind(&ok); | 1967 __ bind(&ok); |
1960 __ ret(0); | 1968 __ ret(0); |
1961 } | 1969 } |
1962 | 1970 |
1963 #undef __ | 1971 #undef __ |
1964 } // namespace internal | 1972 } // namespace internal |
1965 } // namespace v8 | 1973 } // namespace v8 |
1966 | 1974 |
1967 #endif // V8_TARGET_ARCH_X87 | 1975 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |