OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2085 __ j(not_equal, &slow_case); | 2085 __ j(not_equal, &slow_case); |
2086 __ LoadRoot(rax, Heap::kFalseValueRootIndex); | 2086 __ LoadRoot(rax, Heap::kFalseValueRootIndex); |
2087 __ ret(0); | 2087 __ ret(0); |
2088 | 2088 |
2089 // Fast-case: The {function} must be a valid JSFunction. | 2089 // Fast-case: The {function} must be a valid JSFunction. |
2090 __ bind(&fast_case); | 2090 __ bind(&fast_case); |
2091 __ JumpIfSmi(function, &slow_case); | 2091 __ JumpIfSmi(function, &slow_case); |
2092 __ CmpObjectType(function, JS_FUNCTION_TYPE, function_map); | 2092 __ CmpObjectType(function, JS_FUNCTION_TYPE, function_map); |
2093 __ j(not_equal, &slow_case); | 2093 __ j(not_equal, &slow_case); |
2094 | 2094 |
| 2095 // Go to the runtime if the function is not a constructor. |
| 2096 __ testb(FieldOperand(function_map, Map::kBitFieldOffset), |
| 2097 Immediate(1 << Map::kIsConstructor)); |
| 2098 __ j(zero, &slow_case); |
| 2099 |
2095 // Ensure that {function} has an instance prototype. | 2100 // Ensure that {function} has an instance prototype. |
2096 __ testb(FieldOperand(function_map, Map::kBitFieldOffset), | 2101 __ testb(FieldOperand(function_map, Map::kBitFieldOffset), |
2097 Immediate(1 << Map::kHasNonInstancePrototype)); | 2102 Immediate(1 << Map::kHasNonInstancePrototype)); |
2098 __ j(not_zero, &slow_case); | 2103 __ j(not_zero, &slow_case); |
2099 | 2104 |
2100 // Get the "prototype" (or initial map) of the {function}. | 2105 // Get the "prototype" (or initial map) of the {function}. |
2101 __ movp(function_prototype, | 2106 __ movp(function_prototype, |
2102 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2107 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
2103 __ AssertNotSmi(function_prototype); | 2108 __ AssertNotSmi(function_prototype); |
2104 | 2109 |
(...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5584 NULL); | 5589 NULL); |
5585 } | 5590 } |
5586 | 5591 |
5587 | 5592 |
5588 #undef __ | 5593 #undef __ |
5589 | 5594 |
5590 } // namespace internal | 5595 } // namespace internal |
5591 } // namespace v8 | 5596 } // namespace v8 |
5592 | 5597 |
5593 #endif // V8_TARGET_ARCH_X64 | 5598 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |