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 #include <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 #if defined(__thumb__) | 2500 #if defined(__thumb__) |
2501 // Thumb mode builtin. | 2501 // Thumb mode builtin. |
2502 DCHECK((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); | 2502 DCHECK((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); |
2503 #endif | 2503 #endif |
2504 mov(r1, Operand(builtin)); | 2504 mov(r1, Operand(builtin)); |
2505 CEntryStub stub(isolate(), 1); | 2505 CEntryStub stub(isolate(), 1); |
2506 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 2506 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
2507 } | 2507 } |
2508 | 2508 |
2509 | 2509 |
2510 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, | 2510 void MacroAssembler::InvokeBuiltin(int native_context_index, InvokeFlag flag, |
2511 InvokeFlag flag, | |
2512 const CallWrapper& call_wrapper) { | 2511 const CallWrapper& call_wrapper) { |
2513 // You can't call a builtin without a valid frame. | 2512 // You can't call a builtin without a valid frame. |
2514 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 2513 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
2515 | 2514 |
2516 GetBuiltinEntry(r2, id); | 2515 GetBuiltinEntry(r2, native_context_index); |
2517 if (flag == CALL_FUNCTION) { | 2516 if (flag == CALL_FUNCTION) { |
2518 call_wrapper.BeforeCall(CallSize(r2)); | 2517 call_wrapper.BeforeCall(CallSize(r2)); |
2519 Call(r2); | 2518 Call(r2); |
2520 call_wrapper.AfterCall(); | 2519 call_wrapper.AfterCall(); |
2521 } else { | 2520 } else { |
2522 DCHECK(flag == JUMP_FUNCTION); | 2521 DCHECK(flag == JUMP_FUNCTION); |
2523 Jump(r2); | 2522 Jump(r2); |
2524 } | 2523 } |
2525 } | 2524 } |
2526 | 2525 |
2527 | 2526 |
2528 void MacroAssembler::GetBuiltinFunction(Register target, | 2527 void MacroAssembler::GetBuiltinFunction(Register target, |
2529 Builtins::JavaScript id) { | 2528 int native_context_index) { |
2530 // Load the builtins object into target register. | 2529 // Load the builtins object into target register. |
2531 ldr(target, | 2530 ldr(target, |
2532 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2531 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2533 ldr(target, FieldMemOperand(target, GlobalObject::kBuiltinsOffset)); | 2532 ldr(target, FieldMemOperand(target, GlobalObject::kNativeContextOffset)); |
2534 // Load the JavaScript builtin function from the builtins object. | 2533 // Load the JavaScript builtin function from the builtins object. |
2535 ldr(target, FieldMemOperand(target, | 2534 ldr(target, ContextOperand(target, native_context_index)); |
2536 JSBuiltinsObject::OffsetOfFunctionWithId(id))); | |
2537 } | 2535 } |
2538 | 2536 |
2539 | 2537 |
2540 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { | 2538 void MacroAssembler::GetBuiltinEntry(Register target, |
| 2539 int native_context_index) { |
2541 DCHECK(!target.is(r1)); | 2540 DCHECK(!target.is(r1)); |
2542 GetBuiltinFunction(r1, id); | 2541 GetBuiltinFunction(r1, native_context_index); |
2543 // Load the code entry point from the builtins object. | 2542 // Load the code entry point from the builtins object. |
2544 ldr(target, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 2543 ldr(target, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
2545 } | 2544 } |
2546 | 2545 |
2547 | 2546 |
2548 void MacroAssembler::SetCounter(StatsCounter* counter, int value, | 2547 void MacroAssembler::SetCounter(StatsCounter* counter, int value, |
2549 Register scratch1, Register scratch2) { | 2548 Register scratch1, Register scratch2) { |
2550 if (FLAG_native_code_counters && counter->Enabled()) { | 2549 if (FLAG_native_code_counters && counter->Enabled()) { |
2551 mov(scratch1, Operand(value)); | 2550 mov(scratch1, Operand(value)); |
2552 mov(scratch2, Operand(ExternalReference(counter))); | 2551 mov(scratch2, Operand(ExternalReference(counter))); |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3807 } | 3806 } |
3808 } | 3807 } |
3809 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3808 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3810 add(result, result, Operand(dividend, LSR, 31)); | 3809 add(result, result, Operand(dividend, LSR, 31)); |
3811 } | 3810 } |
3812 | 3811 |
3813 } // namespace internal | 3812 } // namespace internal |
3814 } // namespace v8 | 3813 } // namespace v8 |
3815 | 3814 |
3816 #endif // V8_TARGET_ARCH_ARM | 3815 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |