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

Side by Side Diff: src/x64/cfg-x64.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
« src/cfg.h ('K') | « src/ia32/cfg-ia32.cc ('k') | no next file » | no next file with comments »
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 __ ret((count + 1) * kPointerSize); 115 __ ret((count + 1) * kPointerSize);
116 // Add padding that will be overwritten by a debugger breakpoint. 116 // Add padding that will be overwritten by a debugger breakpoint.
117 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2. 117 // "movq rsp, rbp; pop rbp" has length 5. "ret k" has length 2.
118 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2; 118 const int kPadding = Debug::kX64JSReturnSequenceLength - 5 - 2;
119 for (int i = 0; i < kPadding; ++i) { 119 for (int i = 0; i < kPadding; ++i) {
120 __ int3(); 120 __ int3();
121 } 121 }
122 } 122 }
123 123
124 124
125 void PropRefInstr::Compile(MacroAssembler* masm) {
126 // The key should not be on the stack---if it is a compiler-generated
127 // temporary it is in the accumulator.
128 ASSERT(!key()->is_on_stack());
129
130 Comment cmnt(masm, "[ Load from Property");
131 // If the key is known at compile-time we may be able to use a load IC.
132 bool is_keyed_load = true;
133 if (key()->is_constant()) {
134 // Still use the keyed load IC if the key can be parsed as an integer so
135 // we will get into the case that handles [] on string objects.
136 Handle<Object> key_val = Constant::cast(key())->handle();
137 uint32_t ignored;
138 if (key_val->IsSymbol() &&
139 !String::cast(*key_val)->AsArrayIndex(&ignored)) {
140 is_keyed_load = false;
141 }
142 }
143
144 if (!object()->is_on_stack()) object()->Push(masm);
145 // A test rax instruction after the call indicates to the IC code that it
146 // was inlined. Ensure there is not one after the call below.
147 if (is_keyed_load) {
148 key()->Push(masm);
149 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
150 __ Call(ic, RelocInfo::CODE_TARGET);
151 __ pop(kScratchRegister); // Discard key.
William Hesse 2009/08/07 12:50:26 If you don't care what you pop to, popping to a le
Kevin Millikin (Chromium) 2009/08/07 13:25:33 Thanks for the tip, using rbx.
152 } else {
153 key()->Get(masm, rcx);
154 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
155 __ Call(ic, RelocInfo::CODE_TARGET);
156 }
157 __ pop(kScratchRegister); // Discard receiver.
158 location()->Set(masm, rax);
159 }
160
161
125 void BinaryOpInstr::Compile(MacroAssembler* masm) { 162 void BinaryOpInstr::Compile(MacroAssembler* masm) {
126 // The right-hand value should not be on the stack---if it is a 163 // The right-hand value should not be on the stack---if it is a
127 // compiler-generated temporary it is in the accumulator. 164 // compiler-generated temporary it is in the accumulator.
128 ASSERT(!value1()->is_on_stack()); 165 ASSERT(!right()->is_on_stack());
129 166
130 Comment cmnt(masm, "[ BinaryOpInstr"); 167 Comment cmnt(masm, "[ BinaryOpInstr");
131 // We can overwrite one of the operands if it is a temporary. 168 // We can overwrite one of the operands if it is a temporary.
132 OverwriteMode mode = NO_OVERWRITE; 169 OverwriteMode mode = NO_OVERWRITE;
133 if (value0()->is_temporary()) { 170 if (left()->is_temporary()) {
134 mode = OVERWRITE_LEFT; 171 mode = OVERWRITE_LEFT;
135 } else if (value1()->is_temporary()) { 172 } else if (right()->is_temporary()) {
136 mode = OVERWRITE_RIGHT; 173 mode = OVERWRITE_RIGHT;
137 } 174 }
138 175
139 // Push both operands and call the specialized stub. 176 // Push both operands and call the specialized stub.
140 if (!value0()->is_on_stack()) { 177 if (!left()->is_on_stack()) left()->Push(masm);
141 value0()->Push(masm); 178 right()->Push(masm);
142 }
143 value1()->Push(masm);
144 GenericBinaryOpStub stub(op(), mode, SMI_CODE_IN_STUB); 179 GenericBinaryOpStub stub(op(), mode, SMI_CODE_IN_STUB);
145 __ CallStub(&stub); 180 __ CallStub(&stub);
146 location()->Set(masm, rax); 181 location()->Set(masm, rax);
147 } 182 }
148 183
149 184
150 void ReturnInstr::Compile(MacroAssembler* masm) { 185 void ReturnInstr::Compile(MacroAssembler* masm) {
151 // The location should be 'Effect'. As a side effect, move the value to 186 // The location should be 'Effect'. As a side effect, move the value to
152 // the accumulator. 187 // the accumulator.
153 Comment cmnt(masm, "[ ReturnInstr"); 188 Comment cmnt(masm, "[ ReturnInstr");
154 value_->Get(masm, rax); 189 value()->Get(masm, rax);
155 } 190 }
156 191
157 192
158 void Constant::Get(MacroAssembler* masm, Register reg) { 193 void Constant::Get(MacroAssembler* masm, Register reg) {
159 __ Move(reg, handle_); 194 __ Move(reg, handle_);
160 } 195 }
161 196
162 197
163 void Constant::Push(MacroAssembler* masm) { 198 void Constant::Push(MacroAssembler* masm) {
164 __ Push(handle_); 199 __ Push(handle_);
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 break; 314 break;
280 case NOT_ALLOCATED: 315 case NOT_ALLOCATED:
281 UNREACHABLE(); 316 UNREACHABLE();
282 } 317 }
283 } 318 }
284 319
285 320
286 #undef __ 321 #undef __
287 322
288 } } // namespace v8::internal 323 } } // namespace v8::internal
OLDNEW
« src/cfg.h ('K') | « src/ia32/cfg-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698