| 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_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 675 } |
| 676 // Never falls through to here. | 676 // Never falls through to here. |
| 677 | 677 |
| 678 __ bind(&slow); | 678 __ bind(&slow); |
| 679 | 679 |
| 680 __ Push(lhs, rhs); | 680 __ Push(lhs, rhs); |
| 681 // Figure out which native to call and setup the arguments. | 681 // Figure out which native to call and setup the arguments. |
| 682 if (cc == eq && strict()) { | 682 if (cc == eq && strict()) { |
| 683 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1); | 683 __ TailCallRuntime(Runtime::kStrictEquals, 2, 1); |
| 684 } else { | 684 } else { |
| 685 Builtins::JavaScript native; | 685 int context_index; |
| 686 if (cc == eq) { | 686 if (cc == eq) { |
| 687 native = Builtins::EQUALS; | 687 context_index = Context::EQUALS_BUILTIN_INDEX; |
| 688 } else { | 688 } else { |
| 689 native = | 689 context_index = is_strong(strength()) |
| 690 is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; | 690 ? Context::COMPARE_STRONG_BUILTIN_INDEX |
| 691 : Context::COMPARE_BUILTIN_INDEX; |
| 691 int ncr; // NaN compare result | 692 int ncr; // NaN compare result |
| 692 if (cc == lt || cc == le) { | 693 if (cc == lt || cc == le) { |
| 693 ncr = GREATER; | 694 ncr = GREATER; |
| 694 } else { | 695 } else { |
| 695 DCHECK(cc == gt || cc == ge); // remaining cases | 696 DCHECK(cc == gt || cc == ge); // remaining cases |
| 696 ncr = LESS; | 697 ncr = LESS; |
| 697 } | 698 } |
| 698 __ mov(r0, Operand(Smi::FromInt(ncr))); | 699 __ mov(r0, Operand(Smi::FromInt(ncr))); |
| 699 __ push(r0); | 700 __ push(r0); |
| 700 } | 701 } |
| 701 | 702 |
| 702 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) | 703 // Call the native; it returns -1 (less), 0 (equal), or 1 (greater) |
| 703 // tagged as a small integer. | 704 // tagged as a small integer. |
| 704 __ InvokeBuiltin(native, JUMP_FUNCTION); | 705 __ InvokeBuiltin(context_index, JUMP_FUNCTION); |
| 705 } | 706 } |
| 706 | 707 |
| 707 __ bind(&miss); | 708 __ bind(&miss); |
| 708 GenerateMiss(masm); | 709 GenerateMiss(masm); |
| 709 } | 710 } |
| 710 | 711 |
| 711 | 712 |
| 712 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { | 713 void StoreBufferOverflowStub::Generate(MacroAssembler* masm) { |
| 713 // We don't allow a GC during a store buffer overflow so there is no need to | 714 // We don't allow a GC during a store buffer overflow so there is no need to |
| 714 // store the registers in any particular way, but we do have to store and | 715 // store the registers in any particular way, but we do have to store and |
| (...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2419 | 2420 |
| 2420 static void EmitSlowCase(MacroAssembler* masm, | 2421 static void EmitSlowCase(MacroAssembler* masm, |
| 2421 int argc, | 2422 int argc, |
| 2422 Label* non_function) { | 2423 Label* non_function) { |
| 2423 // Check for function proxy. | 2424 // Check for function proxy. |
| 2424 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); | 2425 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 2425 __ b(ne, non_function); | 2426 __ b(ne, non_function); |
| 2426 __ push(r1); // put proxy as additional argument | 2427 __ push(r1); // put proxy as additional argument |
| 2427 __ mov(r0, Operand(argc + 1, RelocInfo::NONE32)); | 2428 __ mov(r0, Operand(argc + 1, RelocInfo::NONE32)); |
| 2428 __ mov(r2, Operand::Zero()); | 2429 __ mov(r2, Operand::Zero()); |
| 2429 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY); | 2430 __ GetBuiltinFunction(r1, Context::CALL_FUNCTION_PROXY_BUILTIN_INDEX); |
| 2430 { | 2431 { |
| 2431 Handle<Code> adaptor = | 2432 Handle<Code> adaptor = |
| 2432 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 2433 masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 2433 __ Jump(adaptor, RelocInfo::CODE_TARGET); | 2434 __ Jump(adaptor, RelocInfo::CODE_TARGET); |
| 2434 } | 2435 } |
| 2435 | 2436 |
| 2436 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead | 2437 // CALL_NON_FUNCTION expects the non-function callee as receiver (instead |
| 2437 // of the original receiver from the call site). | 2438 // of the original receiver from the call site). |
| 2438 __ bind(non_function); | 2439 __ bind(non_function); |
| 2439 __ str(r1, MemOperand(sp, argc * kPointerSize)); | 2440 __ str(r1, MemOperand(sp, argc * kPointerSize)); |
| 2440 __ mov(r0, Operand(argc)); // Set up the number of arguments. | 2441 __ mov(r0, Operand(argc)); // Set up the number of arguments. |
| 2441 __ mov(r2, Operand::Zero()); | 2442 __ mov(r2, Operand::Zero()); |
| 2442 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION); | 2443 __ GetBuiltinFunction(r1, Context::CALL_NON_FUNCTION_BUILTIN_INDEX); |
| 2443 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2444 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 2444 RelocInfo::CODE_TARGET); | 2445 RelocInfo::CODE_TARGET); |
| 2445 } | 2446 } |
| 2446 | 2447 |
| 2447 | 2448 |
| 2448 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { | 2449 static void EmitWrapCase(MacroAssembler* masm, int argc, Label* cont) { |
| 2449 // Wrap the receiver and patch it back onto the stack. | 2450 // Wrap the receiver and patch it back onto the stack. |
| 2450 { FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); | 2451 { FrameAndConstantPoolScope frame_scope(masm, StackFrame::INTERNAL); |
| 2451 __ push(r1); | 2452 __ push(r1); |
| 2452 __ mov(r0, r3); | 2453 __ mov(r0, r3); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2569 SharedFunctionInfo::kConstructStubOffset)); | 2570 SharedFunctionInfo::kConstructStubOffset)); |
| 2570 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); | 2571 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 2571 | 2572 |
| 2572 // r0: number of arguments | 2573 // r0: number of arguments |
| 2573 // r1: called object | 2574 // r1: called object |
| 2574 // r5: object type | 2575 // r5: object type |
| 2575 Label do_call; | 2576 Label do_call; |
| 2576 __ bind(&slow); | 2577 __ bind(&slow); |
| 2577 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE)); | 2578 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE)); |
| 2578 __ b(ne, &non_function_call); | 2579 __ b(ne, &non_function_call); |
| 2579 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); | 2580 __ GetBuiltinFunction( |
| 2581 r1, Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX); |
| 2580 __ jmp(&do_call); | 2582 __ jmp(&do_call); |
| 2581 | 2583 |
| 2582 __ bind(&non_function_call); | 2584 __ bind(&non_function_call); |
| 2583 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); | 2585 __ GetBuiltinFunction( |
| 2586 r1, Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX); |
| 2584 __ bind(&do_call); | 2587 __ bind(&do_call); |
| 2585 // Set expected number of arguments to zero (not changing r0). | 2588 // Set expected number of arguments to zero (not changing r0). |
| 2586 __ mov(r2, Operand::Zero()); | 2589 __ mov(r2, Operand::Zero()); |
| 2587 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 2590 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
| 2588 RelocInfo::CODE_TARGET); | 2591 RelocInfo::CODE_TARGET); |
| 2589 } | 2592 } |
| 2590 | 2593 |
| 2591 | 2594 |
| 2592 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { | 2595 static void EmitLoadTypeFeedbackVector(MacroAssembler* masm, Register vector) { |
| 2593 __ ldr(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 2596 __ ldr(vector, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3254 __ bind(¬_string); | 3257 __ bind(¬_string); |
| 3255 | 3258 |
| 3256 Label not_oddball; | 3259 Label not_oddball; |
| 3257 __ cmp(r1, Operand(ODDBALL_TYPE)); | 3260 __ cmp(r1, Operand(ODDBALL_TYPE)); |
| 3258 __ b(ne, ¬_oddball); | 3261 __ b(ne, ¬_oddball); |
| 3259 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); | 3262 __ ldr(r0, FieldMemOperand(r0, Oddball::kToNumberOffset)); |
| 3260 __ Ret(); | 3263 __ Ret(); |
| 3261 __ bind(¬_oddball); | 3264 __ bind(¬_oddball); |
| 3262 | 3265 |
| 3263 __ push(r0); // Push argument. | 3266 __ push(r0); // Push argument. |
| 3264 __ InvokeBuiltin(Builtins::TO_NUMBER, JUMP_FUNCTION); | 3267 __ InvokeBuiltin(Context::TO_NUMBER_BUILTIN_INDEX, JUMP_FUNCTION); |
| 3265 } | 3268 } |
| 3266 | 3269 |
| 3267 | 3270 |
| 3268 void StringHelper::GenerateFlatOneByteStringEquals( | 3271 void StringHelper::GenerateFlatOneByteStringEquals( |
| 3269 MacroAssembler* masm, Register left, Register right, Register scratch1, | 3272 MacroAssembler* masm, Register left, Register right, Register scratch1, |
| 3270 Register scratch2, Register scratch3) { | 3273 Register scratch2, Register scratch3) { |
| 3271 Register length = scratch1; | 3274 Register length = scratch1; |
| 3272 | 3275 |
| 3273 // Compare lengths. | 3276 // Compare lengths. |
| 3274 Label strings_not_equal, check_zero_length; | 3277 Label strings_not_equal, check_zero_length; |
| (...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5427 MemOperand(fp, 6 * kPointerSize), NULL); | 5430 MemOperand(fp, 6 * kPointerSize), NULL); |
| 5428 } | 5431 } |
| 5429 | 5432 |
| 5430 | 5433 |
| 5431 #undef __ | 5434 #undef __ |
| 5432 | 5435 |
| 5433 } // namespace internal | 5436 } // namespace internal |
| 5434 } // namespace v8 | 5437 } // namespace v8 |
| 5435 | 5438 |
| 5436 #endif // V8_TARGET_ARCH_ARM | 5439 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |