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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 2119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 __ j(not_equal, &slow_case); | 2130 __ j(not_equal, &slow_case); |
2131 __ LoadRoot(eax, Heap::kFalseValueRootIndex); | 2131 __ LoadRoot(eax, Heap::kFalseValueRootIndex); |
2132 __ ret(0); | 2132 __ ret(0); |
2133 | 2133 |
2134 // Fast-case: The {function} must be a valid JSFunction. | 2134 // Fast-case: The {function} must be a valid JSFunction. |
2135 __ bind(&fast_case); | 2135 __ bind(&fast_case); |
2136 __ JumpIfSmi(function, &slow_case); | 2136 __ JumpIfSmi(function, &slow_case); |
2137 __ CmpObjectType(function, JS_FUNCTION_TYPE, function_map); | 2137 __ CmpObjectType(function, JS_FUNCTION_TYPE, function_map); |
2138 __ j(not_equal, &slow_case); | 2138 __ j(not_equal, &slow_case); |
2139 | 2139 |
| 2140 // Go to the runtime if the function is not a constructor. |
| 2141 __ test_b(FieldOperand(function_map, Map::kBitFieldOffset), |
| 2142 static_cast<uint8_t>(1 << Map::kIsConstructor)); |
| 2143 __ j(zero, &slow_case); |
| 2144 |
2140 // Ensure that {function} has an instance prototype. | 2145 // Ensure that {function} has an instance prototype. |
2141 __ test_b(FieldOperand(function_map, Map::kBitFieldOffset), | 2146 __ test_b(FieldOperand(function_map, Map::kBitFieldOffset), |
2142 static_cast<uint8_t>(1 << Map::kHasNonInstancePrototype)); | 2147 static_cast<uint8_t>(1 << Map::kHasNonInstancePrototype)); |
2143 __ j(not_zero, &slow_case); | 2148 __ j(not_zero, &slow_case); |
2144 | 2149 |
2145 // Get the "prototype" (or initial map) of the {function}. | 2150 // Get the "prototype" (or initial map) of the {function}. |
2146 __ mov(function_prototype, | 2151 __ mov(function_prototype, |
2147 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); | 2152 FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset)); |
2148 __ AssertNotSmi(function_prototype); | 2153 __ AssertNotSmi(function_prototype); |
2149 | 2154 |
(...skipping 3708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5858 return_value_operand, NULL); | 5863 return_value_operand, NULL); |
5859 } | 5864 } |
5860 | 5865 |
5861 | 5866 |
5862 #undef __ | 5867 #undef __ |
5863 | 5868 |
5864 } // namespace internal | 5869 } // namespace internal |
5865 } // namespace v8 | 5870 } // namespace v8 |
5866 | 5871 |
5867 #endif // V8_TARGET_ARCH_IA32 | 5872 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |