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/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/handler-compiler.h" | 10 #include "src/ic/handler-compiler.h" |
(...skipping 2033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 // Goto miss case if we do not have a function. | 2044 // Goto miss case if we do not have a function. |
2045 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); | 2045 __ CmpObjectType(rdi, JS_FUNCTION_TYPE, rcx); |
2046 __ j(not_equal, &miss); | 2046 __ j(not_equal, &miss); |
2047 | 2047 |
2048 // Make sure the function is not the Array() function, which requires special | 2048 // Make sure the function is not the Array() function, which requires special |
2049 // behavior on MISS. | 2049 // behavior on MISS. |
2050 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); | 2050 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); |
2051 __ cmpp(rdi, rcx); | 2051 __ cmpp(rdi, rcx); |
2052 __ j(equal, &miss); | 2052 __ j(equal, &miss); |
2053 | 2053 |
| 2054 // Make sure the function belongs to the same native context (which implies |
| 2055 // the same global object). |
| 2056 __ movp(rcx, FieldOperand(rdi, JSFunction::kContextOffset)); |
| 2057 __ movp(rcx, ContextOperand(rcx, Context::GLOBAL_OBJECT_INDEX)); |
| 2058 __ cmpp(rcx, GlobalObjectOperand()); |
| 2059 __ j(not_equal, &miss); |
| 2060 |
2054 // Update stats. | 2061 // Update stats. |
2055 __ SmiAddConstant(FieldOperand(rbx, with_types_offset), Smi::FromInt(1)); | 2062 __ SmiAddConstant(FieldOperand(rbx, with_types_offset), Smi::FromInt(1)); |
2056 | 2063 |
2057 // Initialize the call counter. | 2064 // Initialize the call counter. |
2058 __ Move(FieldOperand(rbx, rdx, times_pointer_size, | 2065 __ Move(FieldOperand(rbx, rdx, times_pointer_size, |
2059 FixedArray::kHeaderSize + kPointerSize), | 2066 FixedArray::kHeaderSize + kPointerSize), |
2060 Smi::FromInt(CallICNexus::kCallCountIncrement)); | 2067 Smi::FromInt(CallICNexus::kCallCountIncrement)); |
2061 | 2068 |
2062 // Store the function. Use a stub since we need a frame for allocation. | 2069 // Store the function. Use a stub since we need a frame for allocation. |
2063 // rbx - vector | 2070 // rbx - vector |
(...skipping 3405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5469 kStackSpace, nullptr, return_value_operand, NULL); | 5476 kStackSpace, nullptr, return_value_operand, NULL); |
5470 } | 5477 } |
5471 | 5478 |
5472 | 5479 |
5473 #undef __ | 5480 #undef __ |
5474 | 5481 |
5475 } // namespace internal | 5482 } // namespace internal |
5476 } // namespace v8 | 5483 } // namespace v8 |
5477 | 5484 |
5478 #endif // V8_TARGET_ARCH_X64 | 5485 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |