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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2273 // {function}. The cached answer will be set when it is known below. | 2273 // {function}. The cached answer will be set when it is known below. |
2274 __ StoreRoot(function, scratch, Heap::kInstanceofCacheFunctionRootIndex); | 2274 __ StoreRoot(function, scratch, Heap::kInstanceofCacheFunctionRootIndex); |
2275 __ StoreRoot(object_map, scratch, Heap::kInstanceofCacheMapRootIndex); | 2275 __ StoreRoot(object_map, scratch, Heap::kInstanceofCacheMapRootIndex); |
2276 | 2276 |
2277 // Loop through the prototype chain looking for the {function} prototype. | 2277 // Loop through the prototype chain looking for the {function} prototype. |
2278 // Assume true, and change to false if not found. | 2278 // Assume true, and change to false if not found. |
2279 Label done, loop, fast_runtime_fallback; | 2279 Label done, loop, fast_runtime_fallback; |
2280 __ mov(eax, isolate()->factory()->true_value()); | 2280 __ mov(eax, isolate()->factory()->true_value()); |
2281 __ bind(&loop); | 2281 __ bind(&loop); |
2282 | 2282 |
| 2283 // Check if the object needs to be access checked. |
2283 __ test_b(FieldOperand(object_map, Map::kBitFieldOffset), | 2284 __ test_b(FieldOperand(object_map, Map::kBitFieldOffset), |
2284 1 << Map::kIsAccessCheckNeeded); | 2285 1 << Map::kIsAccessCheckNeeded); |
2285 __ j(not_zero, &fast_runtime_fallback, Label::kNear); | 2286 __ j(not_zero, &fast_runtime_fallback, Label::kNear); |
| 2287 // Check if the current object is a Proxy. |
2286 __ CmpInstanceType(object_map, JS_PROXY_TYPE); | 2288 __ CmpInstanceType(object_map, JS_PROXY_TYPE); |
2287 __ j(equal, &fast_runtime_fallback, Label::kNear); | 2289 __ j(equal, &fast_runtime_fallback, Label::kNear); |
2288 | 2290 |
2289 __ mov(object, FieldOperand(object_map, Map::kPrototypeOffset)); | 2291 __ mov(object, FieldOperand(object_map, Map::kPrototypeOffset)); |
2290 __ cmp(object, function_prototype); | 2292 __ cmp(object, function_prototype); |
2291 __ j(equal, &done, Label::kNear); | 2293 __ j(equal, &done, Label::kNear); |
| 2294 __ mov(object_map, FieldOperand(object, HeapObject::kMapOffset)); |
2292 __ cmp(object, isolate()->factory()->null_value()); | 2295 __ cmp(object, isolate()->factory()->null_value()); |
2293 __ mov(object_map, FieldOperand(object, HeapObject::kMapOffset)); | |
2294 __ j(not_equal, &loop); | 2296 __ j(not_equal, &loop); |
2295 __ mov(eax, isolate()->factory()->false_value()); | 2297 __ mov(eax, isolate()->factory()->false_value()); |
| 2298 |
2296 __ bind(&done); | 2299 __ bind(&done); |
2297 __ StoreRoot(eax, scratch, Heap::kInstanceofCacheAnswerRootIndex); | 2300 __ StoreRoot(eax, scratch, Heap::kInstanceofCacheAnswerRootIndex); |
2298 __ ret(0); | 2301 __ ret(0); |
2299 | 2302 |
2300 // Found Proxy or access check needed: Call the runtime. | 2303 // Found Proxy or access check needed: Call the runtime. |
2301 __ bind(&fast_runtime_fallback); | 2304 __ bind(&fast_runtime_fallback); |
2302 __ PopReturnAddressTo(scratch); | 2305 __ PopReturnAddressTo(scratch); |
2303 __ Push(object); | 2306 __ Push(object); |
2304 __ Push(function_prototype); | 2307 __ Push(function_prototype); |
2305 __ PushReturnAddressFrom(scratch); | 2308 __ PushReturnAddressFrom(scratch); |
(...skipping 3025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5331 Operand(ebp, 7 * kPointerSize), NULL); | 5334 Operand(ebp, 7 * kPointerSize), NULL); |
5332 } | 5335 } |
5333 | 5336 |
5334 | 5337 |
5335 #undef __ | 5338 #undef __ |
5336 | 5339 |
5337 } // namespace internal | 5340 } // namespace internal |
5338 } // namespace v8 | 5341 } // namespace v8 |
5339 | 5342 |
5340 #endif // V8_TARGET_ARCH_X87 | 5343 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |