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

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

Issue 165129: Added support for property loads to the CFG builder and fast-mode (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 4 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/cfg.h » ('j') | src/cfg.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 __ CallRuntime(Runtime::kTraceExit, 1); 93 __ CallRuntime(Runtime::kTraceExit, 1);
94 } 94 }
95 __ mov(sp, fp); 95 __ mov(sp, fp);
96 __ ldm(ia_w, sp, fp.bit() | lr.bit()); 96 __ ldm(ia_w, sp, fp.bit() | lr.bit());
97 int count = CfgGlobals::current()->fun()->scope()->num_parameters(); 97 int count = CfgGlobals::current()->fun()->scope()->num_parameters();
98 __ add(sp, sp, Operand((count + 1) * kPointerSize)); 98 __ add(sp, sp, Operand((count + 1) * kPointerSize));
99 __ Jump(lr); 99 __ Jump(lr);
100 } 100 }
101 101
102 102
103 void PropRefInstr::Compile(MacroAssembler* masm) {
104 // The key should not be on the stack---if it is a compiler-generated
105 // temporary it is in the accumulator.
106 ASSERT(!key()->is_on_stack());
107
108 Comment cmnt(masm, "[ Load from Property");
109 // If the key is known at compile-time we may be able to use a load IC.
110 bool is_keyed_load = true;
111 if (key()->is_constant()) {
112 // Still use the keyed load IC if the key can be parsed as an integer so
113 // we will get into the case that handles [] on string objects.
114 Handle<Object> key_val = Constant::cast(key())->handle();
115 uint32_t ignored;
116 if (key_val->IsSymbol() &&
117 !String::cast(*key_val)->AsArrayIndex(&ignored)) {
118 is_keyed_load = false;
119 }
120 }
121
122 if (!object()->is_on_stack()) object()->Push(masm);
123
124 if (is_keyed_load) {
125 key()->Push(masm);
126 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
127 __ Call(ic, RelocInfo::CODE_TARGET);
128 // Discard key and receiver.
129 __ add(sp, sp, Operand(2 * kPointerSize));
130 } else {
131 key()->Get(masm, r2);
132 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
133 __ Call(ic, RelocInfo::CODE_TARGET);
134 __ pop(); // Discard receiver.
135 }
136 location()->Set(masm, r0);
137 }
138
139
103 void BinaryOpInstr::Compile(MacroAssembler* masm) { 140 void BinaryOpInstr::Compile(MacroAssembler* masm) {
104 // The right-hand value should not be on the stack---if it is a 141 // The right-hand value should not be on the stack---if it is a
105 // compiler-generated temporary it is in the accumulator. 142 // compiler-generated temporary it is in the accumulator.
106 ASSERT(!value1()->is_on_stack()); 143 ASSERT(!right()->is_on_stack());
107 144
108 Comment cmnt(masm, "[ BinaryOpInstr"); 145 Comment cmnt(masm, "[ BinaryOpInstr");
109 // We can overwrite one of the operands if it is a temporary. 146 // We can overwrite one of the operands if it is a temporary.
110 OverwriteMode mode = NO_OVERWRITE; 147 OverwriteMode mode = NO_OVERWRITE;
111 if (value0()->is_temporary()) { 148 if (left()->is_temporary()) {
112 mode = OVERWRITE_LEFT; 149 mode = OVERWRITE_LEFT;
113 } else if (value1()->is_temporary()) { 150 } else if (right()->is_temporary()) {
114 mode = OVERWRITE_RIGHT; 151 mode = OVERWRITE_RIGHT;
115 } 152 }
116 153
117 // Move left to r1 and right to r0. 154 // Move left to r1 and right to r0.
118 value0()->Get(masm, r1); 155 left()->Get(masm, r1);
119 value1()->Get(masm, r0); 156 right()->Get(masm, r0);
120 GenericBinaryOpStub stub(op(), mode); 157 GenericBinaryOpStub stub(op(), mode);
121 __ CallStub(&stub); 158 __ CallStub(&stub);
122 location()->Set(masm, r0); 159 location()->Set(masm, r0);
123 } 160 }
124 161
125 162
126 void ReturnInstr::Compile(MacroAssembler* masm) { 163 void ReturnInstr::Compile(MacroAssembler* masm) {
127 // The location should be 'Effect'. As a side effect, move the value to 164 // The location should be 'Effect'. As a side effect, move the value to
128 // the accumulator. 165 // the accumulator.
129 Comment cmnt(masm, "[ ReturnInstr"); 166 Comment cmnt(masm, "[ ReturnInstr");
130 value_->Get(masm, r0); 167 value()->Get(masm, r0);
131 } 168 }
132 169
133 170
134 void Constant::Get(MacroAssembler* masm, Register reg) { 171 void Constant::Get(MacroAssembler* masm, Register reg) {
135 __ mov(reg, Operand(handle_)); 172 __ mov(reg, Operand(handle_));
136 } 173 }
137 174
138 175
139 void Constant::Push(MacroAssembler* masm) { 176 void Constant::Push(MacroAssembler* masm) {
140 __ mov(ip, Operand(handle_)); 177 __ mov(ip, Operand(handle_));
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 __ str(ip, ToMemOperand(loc)); 292 __ str(ip, ToMemOperand(loc));
256 break; 293 break;
257 case NOT_ALLOCATED: 294 case NOT_ALLOCATED:
258 UNREACHABLE(); 295 UNREACHABLE();
259 } 296 }
260 } 297 }
261 298
262 #undef __ 299 #undef __
263 300
264 } } // namespace v8::internal 301 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/cfg.h » ('j') | src/cfg.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698