| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 #include "codegen-inl.h" | 30 #include "codegen-inl.h" |
| 31 #include "fast-codegen.h" | 31 #include "fast-codegen.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 #define __ ACCESS_MASM(masm()) | 36 #define __ ACCESS_MASM(masm()) |
| 37 | 37 |
| 38 void FastCodeGenerator::EmitLoadReceiver(Register reg) { | 38 void FastCodeGenerator::EmitLoadReceiver(Register reg) { |
| 39 // Offset 2 is due to return address and saved frame pointer. | 39 // Offset 2 is due to return address and saved frame pointer. |
| 40 int index = 2 + function()->scope()->num_parameters(); | 40 int index = 2 + scope()->num_parameters(); |
| 41 __ ldr(reg, MemOperand(sp, index * kPointerSize)); | 41 __ ldr(reg, MemOperand(sp, index * kPointerSize)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 void FastCodeGenerator::EmitReceiverMapCheck() { | 45 void FastCodeGenerator::EmitReceiverMapCheck() { |
| 46 Comment cmnt(masm(), ";; MapCheck(this)"); | 46 Comment cmnt(masm(), ";; MapCheck(this)"); |
| 47 if (FLAG_print_ir) { | 47 if (FLAG_print_ir) { |
| 48 PrintF("MapCheck(this)\n"); | 48 PrintF("MapCheck(this)\n"); |
| 49 } | 49 } |
| 50 | 50 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 offset += FixedArray::kHeaderSize; | 95 offset += FixedArray::kHeaderSize; |
| 96 __ ldr(r2, FieldMemOperand(r1, JSObject::kPropertiesOffset)); | 96 __ ldr(r2, FieldMemOperand(r1, JSObject::kPropertiesOffset)); |
| 97 } | 97 } |
| 98 // Perform the store. | 98 // Perform the store. |
| 99 __ str(r0, FieldMemOperand(r2, offset)); | 99 __ str(r0, FieldMemOperand(r2, offset)); |
| 100 __ mov(r3, Operand(offset)); | 100 __ mov(r3, Operand(offset)); |
| 101 __ RecordWrite(r2, r3, ip); | 101 __ RecordWrite(r2, r3, ip); |
| 102 } | 102 } |
| 103 | 103 |
| 104 | 104 |
| 105 void FastCodeGenerator::Generate(FunctionLiteral* fun, CompilationInfo* info) { | 105 void FastCodeGenerator::Generate(CompilationInfo* info) { |
| 106 ASSERT(function_ == NULL); | |
| 107 ASSERT(info_ == NULL); | 106 ASSERT(info_ == NULL); |
| 108 function_ = fun; | |
| 109 info_ = info; | 107 info_ = info; |
| 110 | 108 |
| 111 // Save the caller's frame pointer and set up our own. | 109 // Save the caller's frame pointer and set up our own. |
| 112 Comment prologue_cmnt(masm(), ";; Prologue"); | 110 Comment prologue_cmnt(masm(), ";; Prologue"); |
| 113 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); | 111 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); |
| 114 __ add(fp, sp, Operand(2 * kPointerSize)); | 112 __ add(fp, sp, Operand(2 * kPointerSize)); |
| 115 // Note that we keep a live register reference to cp (context) at | 113 // Note that we keep a live register reference to cp (context) at |
| 116 // this point. | 114 // this point. |
| 117 | 115 |
| 118 // Receiver (this) is allocated to r1 if there are this properties. | 116 // Receiver (this) is allocated to r1 if there are this properties. |
| 119 if (has_this_properties()) EmitReceiverMapCheck(); | 117 if (has_this_properties()) EmitReceiverMapCheck(); |
| 120 | 118 |
| 121 VisitStatements(fun->body()); | 119 VisitStatements(function()->body()); |
| 122 | 120 |
| 123 Comment return_cmnt(masm(), ";; Return(<undefined>)"); | 121 Comment return_cmnt(masm(), ";; Return(<undefined>)"); |
| 124 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | 122 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); |
| 125 | 123 |
| 126 Comment epilogue_cmnt(masm(), ";; Epilogue"); | 124 Comment epilogue_cmnt(masm(), ";; Epilogue"); |
| 127 __ mov(sp, fp); | 125 __ mov(sp, fp); |
| 128 __ ldm(ia_w, sp, fp.bit() | lr.bit()); | 126 __ ldm(ia_w, sp, fp.bit() | lr.bit()); |
| 129 int32_t sp_delta = (fun->scope()->num_parameters() + 1) * kPointerSize; | 127 int32_t sp_delta = (scope()->num_parameters() + 1) * kPointerSize; |
| 130 __ add(sp, sp, Operand(sp_delta)); | 128 __ add(sp, sp, Operand(sp_delta)); |
| 131 __ Jump(lr); | 129 __ Jump(lr); |
| 132 | 130 |
| 133 __ bind(&bailout_); | 131 __ bind(&bailout_); |
| 134 } | 132 } |
| 135 | 133 |
| 136 | 134 |
| 137 #undef __ | 135 #undef __ |
| 138 | 136 |
| 139 | 137 |
| 140 } } // namespace v8::internal | 138 } } // namespace v8::internal |
| OLD | NEW |