| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 // Open a frame scope to indicate that there is a frame on the stack. The | 168 // Open a frame scope to indicate that there is a frame on the stack. The |
| 169 // MANUAL indicates that the scope shouldn't actually generate code to set up | 169 // MANUAL indicates that the scope shouldn't actually generate code to set up |
| 170 // the frame (that is done below). | 170 // the frame (that is done below). |
| 171 FrameScope frame_scope(masm_, StackFrame::MANUAL); | 171 FrameScope frame_scope(masm_, StackFrame::MANUAL); |
| 172 | 172 |
| 173 info->set_prologue_offset(masm_->pc_offset()); | 173 info->set_prologue_offset(masm_->pc_offset()); |
| 174 // The following three instructions must remain together and unmodified for | 174 // The following three instructions must remain together and unmodified for |
| 175 // code aging to work properly. | 175 // code aging to work properly. |
| 176 __ Push(ra, fp, cp, a1); | 176 __ Push(ra, fp, cp, a1); |
| 177 // Load undefined value here, so the value is ready for the loop | 177 __ nop(Assembler::CODE_AGE_SEQUENCE_NOP); |
| 178 // below. | |
| 179 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | |
| 180 // Adjust fp to point to caller's fp. | 178 // Adjust fp to point to caller's fp. |
| 181 __ Addu(fp, sp, Operand(2 * kPointerSize)); | 179 __ Addu(fp, sp, Operand(2 * kPointerSize)); |
| 182 info->AddNoFrameRange(0, masm_->pc_offset()); | 180 info->AddNoFrameRange(0, masm_->pc_offset()); |
| 183 | 181 |
| 184 { Comment cmnt(masm_, "[ Allocate locals"); | 182 { Comment cmnt(masm_, "[ Allocate locals"); |
| 185 int locals_count = info->scope()->num_stack_slots(); | 183 int locals_count = info->scope()->num_stack_slots(); |
| 186 // Generators allocate locals, if any, in context slots. | 184 // Generators allocate locals, if any, in context slots. |
| 187 ASSERT(!info->function()->is_generator() || locals_count == 0); | 185 ASSERT(!info->function()->is_generator() || locals_count == 0); |
| 188 for (int i = 0; i < locals_count; i++) { | 186 if (locals_count > 0) { |
| 189 __ push(at); | 187 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 188 for (int i = 0; i < locals_count; i++) { |
| 189 __ push(at); |
| 190 } |
| 190 } | 191 } |
| 191 } | 192 } |
| 192 | 193 |
| 193 bool function_in_register = true; | 194 bool function_in_register = true; |
| 194 | 195 |
| 195 // Possibly allocate a local context. | 196 // Possibly allocate a local context. |
| 196 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 197 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 197 if (heap_slots > 0) { | 198 if (heap_slots > 0) { |
| 198 Comment cmnt(masm_, "[ Allocate context"); | 199 Comment cmnt(masm_, "[ Allocate context"); |
| 199 // Argument to NewContext is the function, which is still in a1. | 200 // Argument to NewContext is the function, which is still in a1. |
| (...skipping 3538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3738 context()->Plug(result); | 3739 context()->Plug(result); |
| 3739 } | 3740 } |
| 3740 | 3741 |
| 3741 | 3742 |
| 3742 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { | 3743 void FullCodeGenerator::EmitStringAdd(CallRuntime* expr) { |
| 3743 ZoneList<Expression*>* args = expr->arguments(); | 3744 ZoneList<Expression*>* args = expr->arguments(); |
| 3744 ASSERT_EQ(2, args->length()); | 3745 ASSERT_EQ(2, args->length()); |
| 3745 VisitForStackValue(args->at(0)); | 3746 VisitForStackValue(args->at(0)); |
| 3746 VisitForStackValue(args->at(1)); | 3747 VisitForStackValue(args->at(1)); |
| 3747 | 3748 |
| 3748 StringAddStub stub(NO_STRING_ADD_FLAGS); | 3749 StringAddStub stub(STRING_ADD_CHECK_BOTH); |
| 3749 __ CallStub(&stub); | 3750 __ CallStub(&stub); |
| 3750 context()->Plug(v0); | 3751 context()->Plug(v0); |
| 3751 } | 3752 } |
| 3752 | 3753 |
| 3753 | 3754 |
| 3754 void FullCodeGenerator::EmitStringCompare(CallRuntime* expr) { | 3755 void FullCodeGenerator::EmitStringCompare(CallRuntime* expr) { |
| 3755 ZoneList<Expression*>* args = expr->arguments(); | 3756 ZoneList<Expression*>* args = expr->arguments(); |
| 3756 ASSERT_EQ(2, args->length()); | 3757 ASSERT_EQ(2, args->length()); |
| 3757 | 3758 |
| 3758 VisitForStackValue(args->at(0)); | 3759 VisitForStackValue(args->at(0)); |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4462 // We need a second deoptimization point after loading the value | 4463 // We need a second deoptimization point after loading the value |
| 4463 // in case evaluating the property load my have a side effect. | 4464 // in case evaluating the property load my have a side effect. |
| 4464 if (assign_type == VARIABLE) { | 4465 if (assign_type == VARIABLE) { |
| 4465 PrepareForBailout(expr->expression(), TOS_REG); | 4466 PrepareForBailout(expr->expression(), TOS_REG); |
| 4466 } else { | 4467 } else { |
| 4467 PrepareForBailoutForId(prop->LoadId(), TOS_REG); | 4468 PrepareForBailoutForId(prop->LoadId(), TOS_REG); |
| 4468 } | 4469 } |
| 4469 | 4470 |
| 4470 // Call ToNumber only if operand is not a smi. | 4471 // Call ToNumber only if operand is not a smi. |
| 4471 Label no_conversion; | 4472 Label no_conversion; |
| 4472 __ JumpIfSmi(v0, &no_conversion); | 4473 if (ShouldInlineSmiCase(expr->op())) { |
| 4474 __ JumpIfSmi(v0, &no_conversion); |
| 4475 } |
| 4473 __ mov(a0, v0); | 4476 __ mov(a0, v0); |
| 4474 ToNumberStub convert_stub; | 4477 ToNumberStub convert_stub; |
| 4475 __ CallStub(&convert_stub); | 4478 __ CallStub(&convert_stub); |
| 4476 __ bind(&no_conversion); | 4479 __ bind(&no_conversion); |
| 4477 | 4480 |
| 4478 // Save result for postfix expressions. | 4481 // Save result for postfix expressions. |
| 4479 if (expr->is_postfix()) { | 4482 if (expr->is_postfix()) { |
| 4480 if (!context()->IsEffect()) { | 4483 if (!context()->IsEffect()) { |
| 4481 // Save the result on the stack. If we have a named or keyed property | 4484 // Save the result on the stack. If we have a named or keyed property |
| 4482 // we store the result under the receiver that is currently on top | 4485 // we store the result under the receiver that is currently on top |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4945 *context_length = 0; | 4948 *context_length = 0; |
| 4946 return previous_; | 4949 return previous_; |
| 4947 } | 4950 } |
| 4948 | 4951 |
| 4949 | 4952 |
| 4950 #undef __ | 4953 #undef __ |
| 4951 | 4954 |
| 4952 } } // namespace v8::internal | 4955 } } // namespace v8::internal |
| 4953 | 4956 |
| 4954 #endif // V8_TARGET_ARCH_MIPS | 4957 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |