Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: src/arm/codegen-arm.cc

Issue 1694016: Simplify the use of the stm instruction on ARM. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/arm/ic-arm.cc » ('j') | src/arm/macro-assembler-arm.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 frame_->EmitPush(ip); 612 frame_->EmitPush(ip);
613 } else { 613 } else {
614 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT); 614 ArgumentsAccessStub stub(ArgumentsAccessStub::NEW_OBJECT);
615 __ ldr(r2, frame_->Function()); 615 __ ldr(r2, frame_->Function());
616 // The receiver is below the arguments, the return address, and the 616 // The receiver is below the arguments, the return address, and the
617 // frame pointer on the stack. 617 // frame pointer on the stack.
618 const int kReceiverDisplacement = 2 + scope()->num_parameters(); 618 const int kReceiverDisplacement = 2 + scope()->num_parameters();
619 __ add(r1, fp, Operand(kReceiverDisplacement * kPointerSize)); 619 __ add(r1, fp, Operand(kReceiverDisplacement * kPointerSize));
620 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters()))); 620 __ mov(r0, Operand(Smi::FromInt(scope()->num_parameters())));
621 frame_->Adjust(3); 621 frame_->Adjust(3);
622 __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit()); 622 __ Push(r2, r1, r0);
623 frame_->CallStub(&stub, 3); 623 frame_->CallStub(&stub, 3);
624 frame_->EmitPush(r0); 624 frame_->EmitPush(r0);
625 } 625 }
626 626
627 Variable* arguments = scope()->arguments()->var(); 627 Variable* arguments = scope()->arguments()->var();
628 Variable* shadow = scope()->arguments_shadow()->var(); 628 Variable* shadow = scope()->arguments_shadow()->var();
629 ASSERT(arguments != NULL && arguments->slot() != NULL); 629 ASSERT(arguments != NULL && arguments->slot() != NULL);
630 ASSERT(shadow != NULL && shadow->slot() != NULL); 630 ASSERT(shadow != NULL && shadow->slot() != NULL);
631 JumpTarget done; 631 JumpTarget done;
632 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) { 632 if (mode == LAZY_ARGUMENTS_ALLOCATION && !initial) {
(...skipping 3797 matching lines...) Expand 10 before | Expand all | Expand 10 after
4430 } 4430 }
4431 4431
4432 virtual void Generate(); 4432 virtual void Generate();
4433 4433
4434 private: 4434 private:
4435 Register dst_, cache_, key_; 4435 Register dst_, cache_, key_;
4436 }; 4436 };
4437 4437
4438 4438
4439 void DeferredSearchCache::Generate() { 4439 void DeferredSearchCache::Generate() {
4440 __ push(cache_); 4440 __ Push(cache_, key_);
4441 __ push(key_);
4442 __ CallRuntime(Runtime::kGetFromCache, 2); 4441 __ CallRuntime(Runtime::kGetFromCache, 2);
4443 if (!dst_.is(r0)) { 4442 if (!dst_.is(r0)) {
4444 __ mov(dst_, r0); 4443 __ mov(dst_, r0);
4445 } 4444 }
4446 } 4445 }
4447 4446
4448 4447
4449 void CodeGenerator::GenerateGetFromCache(ZoneList<Expression*>* args) { 4448 void CodeGenerator::GenerateGetFromCache(ZoneList<Expression*>* args) {
4450 ASSERT_EQ(2, args->length()); 4449 ASSERT_EQ(2, args->length());
4451 4450
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
5490 __ str(r2, FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset)); 5489 __ str(r2, FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset));
5491 __ str(r3, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); 5490 __ str(r3, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset));
5492 __ str(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); 5491 __ str(cp, FieldMemOperand(r0, JSFunction::kContextOffset));
5493 __ str(r1, FieldMemOperand(r0, JSFunction::kLiteralsOffset)); 5492 __ str(r1, FieldMemOperand(r0, JSFunction::kLiteralsOffset));
5494 5493
5495 // Return result. The argument function info has been popped already. 5494 // Return result. The argument function info has been popped already.
5496 __ Ret(); 5495 __ Ret();
5497 5496
5498 // Create a new closure through the slower runtime call. 5497 // Create a new closure through the slower runtime call.
5499 __ bind(&gc); 5498 __ bind(&gc);
5500 __ push(cp); 5499 __ Push(cp, r3);
5501 __ push(r3);
5502 __ TailCallRuntime(Runtime::kNewClosure, 2, 1); 5500 __ TailCallRuntime(Runtime::kNewClosure, 2, 1);
5503 } 5501 }
5504 5502
5505 5503
5506 void FastNewContextStub::Generate(MacroAssembler* masm) { 5504 void FastNewContextStub::Generate(MacroAssembler* masm) {
5507 // Try to allocate the context in new space. 5505 // Try to allocate the context in new space.
5508 Label gc; 5506 Label gc;
5509 int length = slots_ + Context::MIN_CONTEXT_SLOTS; 5507 int length = slots_ + Context::MIN_CONTEXT_SLOTS;
5510 5508
5511 // Attempt to allocate the context in new space. 5509 // Attempt to allocate the context in new space.
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
6321 r1, 6319 r1,
6322 r0, 6320 r0,
6323 r2, 6321 r2,
6324 r3, 6322 r3,
6325 r4, 6323 r4,
6326 r5); 6324 r5);
6327 // Never falls through to here. 6325 // Never falls through to here.
6328 6326
6329 __ bind(&slow); 6327 __ bind(&slow);
6330 6328
6331 __ push(r1); 6329 __ Push(r1, r0);
6332 __ push(r0);
6333 // Figure out which native to call and setup the arguments. 6330 // Figure out which native to call and setup the arguments.
6334 Builtins::JavaScript native; 6331 Builtins::JavaScript native;
6335 if (cc_ == eq) { 6332 if (cc_ == eq) {
6336 native = strict_ ? Builtins::STRICT_EQUALS : Builtins::EQUALS; 6333 native = strict_ ? Builtins::STRICT_EQUALS : Builtins::EQUALS;
6337 } else { 6334 } else {
6338 native = Builtins::COMPARE; 6335 native = Builtins::COMPARE;
6339 int ncr; // NaN compare result 6336 int ncr; // NaN compare result
6340 if (cc_ == lt || cc_ == le) { 6337 if (cc_ == lt || cc_ == le) {
6341 ncr = GREATER; 6338 ncr = GREATER;
6342 } else { 6339 } else {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
6587 __ b(&slow); 6584 __ b(&slow);
6588 __ bind(&slow_reverse); 6585 __ bind(&slow_reverse);
6589 __ Swap(r0, r1, ip); 6586 __ Swap(r0, r1, ip);
6590 } 6587 }
6591 6588
6592 // We jump to here if something goes wrong (one param is not a number of any 6589 // We jump to here if something goes wrong (one param is not a number of any
6593 // sort or new-space allocation fails). 6590 // sort or new-space allocation fails).
6594 __ bind(&slow); 6591 __ bind(&slow);
6595 6592
6596 // Push arguments to the stack 6593 // Push arguments to the stack
6597 __ push(r1); 6594 __ Push(r1, r0);
6598 __ push(r0);
6599 6595
6600 if (Token::ADD == op_) { 6596 if (Token::ADD == op_) {
6601 // Test for string arguments before calling runtime. 6597 // Test for string arguments before calling runtime.
6602 // r1 : first argument 6598 // r1 : first argument
6603 // r0 : second argument 6599 // r0 : second argument
6604 // sp[0] : second argument 6600 // sp[0] : second argument
6605 // sp[4] : first argument 6601 // sp[4] : first argument
6606 6602
6607 Label not_strings, not_string1, string1, string1_smi2; 6603 Label not_strings, not_string1, string1, string1_smi2;
6608 __ tst(r1, Operand(kSmiTagMask)); 6604 __ tst(r1, Operand(kSmiTagMask));
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
6842 6838
6843 if (mode_ != NO_OVERWRITE) { 6839 if (mode_ != NO_OVERWRITE) {
6844 __ bind(&have_to_allocate); 6840 __ bind(&have_to_allocate);
6845 // Get a new heap number in r5. r6 and r7 are scratch. 6841 // Get a new heap number in r5. r6 and r7 are scratch.
6846 __ AllocateHeapNumber(r5, r6, r7, &slow); 6842 __ AllocateHeapNumber(r5, r6, r7, &slow);
6847 __ jmp(&got_a_heap_number); 6843 __ jmp(&got_a_heap_number);
6848 } 6844 }
6849 6845
6850 // If all else failed then we go to the runtime system. 6846 // If all else failed then we go to the runtime system.
6851 __ bind(&slow); 6847 __ bind(&slow);
6852 __ push(lhs); // restore stack 6848 __ Push(lhs, rhs); // Restore stack.
6853 __ push(rhs);
6854 switch (op_) { 6849 switch (op_) {
6855 case Token::BIT_OR: 6850 case Token::BIT_OR:
6856 __ InvokeBuiltin(Builtins::BIT_OR, JUMP_JS); 6851 __ InvokeBuiltin(Builtins::BIT_OR, JUMP_JS);
6857 break; 6852 break;
6858 case Token::BIT_AND: 6853 case Token::BIT_AND:
6859 __ InvokeBuiltin(Builtins::BIT_AND, JUMP_JS); 6854 __ InvokeBuiltin(Builtins::BIT_AND, JUMP_JS);
6860 break; 6855 break;
6861 case Token::BIT_XOR: 6856 case Token::BIT_XOR:
6862 __ InvokeBuiltin(Builtins::BIT_XOR, JUMP_JS); 6857 __ InvokeBuiltin(Builtins::BIT_XOR, JUMP_JS);
6863 break; 6858 break;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
7241 if (runtime_operands_type_ != BinaryOpIC::DEFAULT) { 7236 if (runtime_operands_type_ != BinaryOpIC::DEFAULT) {
7242 GenericBinaryOpStub uninit(MinorKey(), BinaryOpIC::DEFAULT); 7237 GenericBinaryOpStub uninit(MinorKey(), BinaryOpIC::DEFAULT);
7243 __ CallStub(&uninit); 7238 __ CallStub(&uninit);
7244 } 7239 }
7245 } 7240 }
7246 7241
7247 7242
7248 void GenericBinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) { 7243 void GenericBinaryOpStub::GenerateTypeTransition(MacroAssembler* masm) {
7249 Label get_result; 7244 Label get_result;
7250 7245
7251 __ push(r1); 7246 __ Push(r1, r0);
7252 __ push(r0);
7253 7247
7254 // Internal frame is necessary to handle exceptions properly. 7248 // Internal frame is necessary to handle exceptions properly.
7255 __ EnterInternalFrame(); 7249 __ EnterInternalFrame();
7256 // Call the stub proper to get the result in r0. 7250 // Call the stub proper to get the result in r0.
7257 __ Call(&get_result); 7251 __ Call(&get_result);
7258 __ LeaveInternalFrame(); 7252 __ LeaveInternalFrame();
7259 7253
7260 __ push(r0); 7254 __ push(r0);
7261 7255
7262 __ mov(r0, Operand(Smi::FromInt(MinorKey()))); 7256 __ mov(r0, Operand(Smi::FromInt(MinorKey())));
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
7716 // r1: function 7710 // r1: function
7717 // r2: receiver 7711 // r2: receiver
7718 // r3: argc 7712 // r3: argc
7719 // r4: argv 7713 // r4: argv
7720 __ mov(r8, Operand(-1)); // Push a bad frame pointer to fail if it is used. 7714 __ mov(r8, Operand(-1)); // Push a bad frame pointer to fail if it is used.
7721 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; 7715 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
7722 __ mov(r7, Operand(Smi::FromInt(marker))); 7716 __ mov(r7, Operand(Smi::FromInt(marker)));
7723 __ mov(r6, Operand(Smi::FromInt(marker))); 7717 __ mov(r6, Operand(Smi::FromInt(marker)));
7724 __ mov(r5, Operand(ExternalReference(Top::k_c_entry_fp_address))); 7718 __ mov(r5, Operand(ExternalReference(Top::k_c_entry_fp_address)));
7725 __ ldr(r5, MemOperand(r5)); 7719 __ ldr(r5, MemOperand(r5));
7726 __ stm(db_w, sp, r5.bit() | r6.bit() | r7.bit() | r8.bit()); 7720 __ Push(r8, r7, r6, r5);
7727 7721
7728 // Setup frame pointer for the frame to be pushed. 7722 // Setup frame pointer for the frame to be pushed.
7729 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); 7723 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset));
7730 7724
7731 // Call a faked try-block that does the invoke. 7725 // Call a faked try-block that does the invoke.
7732 __ bl(&invoke); 7726 __ bl(&invoke);
7733 7727
7734 // Caught exception: Store result (exception) in the pending 7728 // Caught exception: Store result (exception) in the pending
7735 // exception field in the JSEnv and return a failure sentinel. 7729 // exception field in the JSEnv and return a failure sentinel.
7736 // Coming in here the fp will be invalid because the PushTryHandler below 7730 // Coming in here the fp will be invalid because the PushTryHandler below
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
9351 9345
9352 // Just jump to runtime to add the two strings. 9346 // Just jump to runtime to add the two strings.
9353 __ bind(&string_add_runtime); 9347 __ bind(&string_add_runtime);
9354 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); 9348 __ TailCallRuntime(Runtime::kStringAdd, 2, 1);
9355 } 9349 }
9356 9350
9357 9351
9358 #undef __ 9352 #undef __
9359 9353
9360 } } // namespace v8::internal 9354 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/ic-arm.cc » ('j') | src/arm/macro-assembler-arm.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698