| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // Runtime::TraceExit returns its parameter in r0. | 192 // Runtime::TraceExit returns its parameter in r0. |
| 193 __ push(r0); | 193 __ push(r0); |
| 194 __ CallRuntime(Runtime::kTraceExit, 1); | 194 __ CallRuntime(Runtime::kTraceExit, 1); |
| 195 } | 195 } |
| 196 | 196 |
| 197 #ifdef DEBUG | 197 #ifdef DEBUG |
| 198 // Add a label for checking the size of the code used for returning. | 198 // Add a label for checking the size of the code used for returning. |
| 199 Label check_exit_codesize; | 199 Label check_exit_codesize; |
| 200 masm_->bind(&check_exit_codesize); | 200 masm_->bind(&check_exit_codesize); |
| 201 #endif | 201 #endif |
| 202 | 202 // Make sure that the constant pool is not emitted inside of the return |
| 203 { // NOLINT | 203 // sequence. |
| 204 // Make sure that the constant pool is not emitted inside of the return | 204 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
| 205 // sequence. | |
| 206 Assembler::BlockConstPoolScope block_const_pool(masm_); | |
| 207 | |
| 208 // Here we use masm_-> instead of the __ macro to avoid the code coverage | 205 // Here we use masm_-> instead of the __ macro to avoid the code coverage |
| 209 // tool from instrumenting as we rely on the code size here. | 206 // tool from instrumenting as we rely on the code size here. |
| 210 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize; | 207 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize; |
| 211 CodeGenerator::RecordPositions(masm_, position); | 208 CodeGenerator::RecordPositions(masm_, position); |
| 212 __ RecordJSReturn(); | 209 __ RecordJSReturn(); |
| 213 masm_->mov(sp, fp); | 210 masm_->mov(sp, fp); |
| 214 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); | 211 masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); |
| 215 masm_->add(sp, sp, Operand(sp_delta)); | 212 masm_->add(sp, sp, Operand(sp_delta)); |
| 216 masm_->Jump(lr); | 213 masm_->Jump(lr); |
| 217 } | 214 } |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 Property* property = var->AsProperty(); | 693 Property* property = var->AsProperty(); |
| 697 | 694 |
| 698 if (var->is_global() && !var->is_this()) { | 695 if (var->is_global() && !var->is_this()) { |
| 699 Comment cmnt(masm_, "Global variable"); | 696 Comment cmnt(masm_, "Global variable"); |
| 700 // Use inline caching. Variable name is passed in r2 and the global | 697 // Use inline caching. Variable name is passed in r2 and the global |
| 701 // object on the stack. | 698 // object on the stack. |
| 702 __ ldr(ip, CodeGenerator::GlobalObject()); | 699 __ ldr(ip, CodeGenerator::GlobalObject()); |
| 703 __ push(ip); | 700 __ push(ip); |
| 704 __ mov(r2, Operand(var->name())); | 701 __ mov(r2, Operand(var->name())); |
| 705 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 702 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 706 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); | 703 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
| 704 __ Call(ic, RelocInfo::CODE_TARGET_CONTEXT); |
| 705 // A B instruction following the call signals that the load was inlined. |
| 706 // Ensure that there is not a B instruction here. |
| 707 __ nop(); |
| 708 } |
| 707 DropAndApply(1, context, r0); | 709 DropAndApply(1, context, r0); |
| 708 | 710 |
| 709 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { | 711 } else if (slot != NULL && slot->type() == Slot::LOOKUP) { |
| 710 Comment cmnt(masm_, "Lookup slot"); | 712 Comment cmnt(masm_, "Lookup slot"); |
| 711 __ mov(r1, Operand(var->name())); | 713 __ mov(r1, Operand(var->name())); |
| 712 __ stm(db_w, sp, cp.bit() | r1.bit()); // Context and name. | 714 __ stm(db_w, sp, cp.bit() | r1.bit()); // Context and name. |
| 713 __ CallRuntime(Runtime::kLoadContextSlot, 2); | 715 __ CallRuntime(Runtime::kLoadContextSlot, 2); |
| 714 Apply(context, r0); | 716 Apply(context, r0); |
| 715 | 717 |
| 716 } else if (slot != NULL) { | 718 } else if (slot != NULL) { |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 break; | 996 break; |
| 995 } | 997 } |
| 996 } | 998 } |
| 997 | 999 |
| 998 | 1000 |
| 999 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 1001 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 1000 SetSourcePosition(prop->position()); | 1002 SetSourcePosition(prop->position()); |
| 1001 Literal* key = prop->key()->AsLiteral(); | 1003 Literal* key = prop->key()->AsLiteral(); |
| 1002 __ mov(r2, Operand(key->handle())); | 1004 __ mov(r2, Operand(key->handle())); |
| 1003 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1005 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 1004 __ Call(ic, RelocInfo::CODE_TARGET); | 1006 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
| 1007 __ Call(ic, RelocInfo::CODE_TARGET); |
| 1008 // A B instruction following the call signals that the load was inlined. |
| 1009 // Ensure that there is not a B instruction here. |
| 1010 __ nop(); |
| 1011 } |
| 1005 } | 1012 } |
| 1006 | 1013 |
| 1007 | 1014 |
| 1008 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 1015 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 1009 SetSourcePosition(prop->position()); | 1016 SetSourcePosition(prop->position()); |
| 1010 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); | 1017 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize)); |
| 1011 __ Call(ic, RelocInfo::CODE_TARGET); | 1018 __ Call(ic, RelocInfo::CODE_TARGET); |
| 1012 } | 1019 } |
| 1013 | 1020 |
| 1014 | 1021 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1431 if (proxy != NULL && | 1438 if (proxy != NULL && |
| 1432 !proxy->var()->is_this() && | 1439 !proxy->var()->is_this() && |
| 1433 proxy->var()->is_global()) { | 1440 proxy->var()->is_global()) { |
| 1434 Comment cmnt(masm_, "Global variable"); | 1441 Comment cmnt(masm_, "Global variable"); |
| 1435 __ ldr(r0, CodeGenerator::GlobalObject()); | 1442 __ ldr(r0, CodeGenerator::GlobalObject()); |
| 1436 __ push(r0); | 1443 __ push(r0); |
| 1437 __ mov(r2, Operand(proxy->name())); | 1444 __ mov(r2, Operand(proxy->name())); |
| 1438 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); | 1445 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize)); |
| 1439 // Use a regular load, not a contextual load, to avoid a reference | 1446 // Use a regular load, not a contextual load, to avoid a reference |
| 1440 // error. | 1447 // error. |
| 1441 __ Call(ic, RelocInfo::CODE_TARGET); | 1448 { Assembler::BlockConstPoolScope block_const_pool(masm_); |
| 1449 __ Call(ic, RelocInfo::CODE_TARGET); |
| 1450 // A B instruction following the call signals that the load was |
| 1451 // inlined. Ensure that there is not a B instruction here. |
| 1452 __ nop(); |
| 1453 } |
| 1442 __ str(r0, MemOperand(sp)); | 1454 __ str(r0, MemOperand(sp)); |
| 1443 } else if (proxy != NULL && | 1455 } else if (proxy != NULL && |
| 1444 proxy->var()->slot() != NULL && | 1456 proxy->var()->slot() != NULL && |
| 1445 proxy->var()->slot()->type() == Slot::LOOKUP) { | 1457 proxy->var()->slot()->type() == Slot::LOOKUP) { |
| 1446 __ mov(r0, Operand(proxy->name())); | 1458 __ mov(r0, Operand(proxy->name())); |
| 1447 __ stm(db_w, sp, cp.bit() | r0.bit()); | 1459 __ stm(db_w, sp, cp.bit() | r0.bit()); |
| 1448 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); | 1460 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); |
| 1449 __ push(r0); | 1461 __ push(r0); |
| 1450 } else { | 1462 } else { |
| 1451 // This expression cannot throw a reference error at the top level. | 1463 // This expression cannot throw a reference error at the top level. |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 __ pop(result_register()); | 1871 __ pop(result_register()); |
| 1860 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); | 1872 ASSERT_EQ(1, kSmiTagSize + kSmiShiftSize); |
| 1861 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. | 1873 __ mov(r1, Operand(r1, ASR, 1)); // Un-smi-tag value. |
| 1862 __ add(pc, r1, Operand(masm_->CodeObject())); | 1874 __ add(pc, r1, Operand(masm_->CodeObject())); |
| 1863 } | 1875 } |
| 1864 | 1876 |
| 1865 | 1877 |
| 1866 #undef __ | 1878 #undef __ |
| 1867 | 1879 |
| 1868 } } // namespace v8::internal | 1880 } } // namespace v8::internal |
| OLD | NEW |