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

Side by Side Diff: src/ia32/cfg-ia32.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
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 __ CallRuntime(Runtime::kTraceExit, 1); 106 __ CallRuntime(Runtime::kTraceExit, 1);
107 } 107 }
108 __ RecordJSReturn(); 108 __ RecordJSReturn();
109 __ mov(esp, ebp); 109 __ mov(esp, ebp);
110 __ pop(ebp); 110 __ pop(ebp);
111 int count = CfgGlobals::current()->fun()->scope()->num_parameters(); 111 int count = CfgGlobals::current()->fun()->scope()->num_parameters();
112 __ ret((count + 1) * kPointerSize); 112 __ ret((count + 1) * kPointerSize);
113 } 113 }
114 114
115 115
116 void PropRefInstr::Compile(MacroAssembler* masm) {
117 // The key should not be on the stack---if it is a compiler-generated
118 // temporary it is in the accumulator.
119 ASSERT(!key()->is_on_stack());
120
121 Comment cmnt(masm, "[ Load from Property");
122 // If the key is known at compile-time we may be able to use a load IC.
123 bool is_keyed_load = true;
124 if (key()->is_constant()) {
125 // Still use the keyed load IC if the key can be parsed as an integer so
126 // we will get into the case that handles [] on string objects.
127 Handle<Object> key_val = Constant::cast(key())->handle();
128 uint32_t ignored;
129 if (key_val->IsSymbol() &&
130 !String::cast(*key_val)->AsArrayIndex(&ignored)) {
131 is_keyed_load = false;
132 }
133 }
134
135 if (!object()->is_on_stack()) object()->Push(masm);
136 // A test eax instruction after the call indicates to the IC code that it
137 // was inlined. Ensure there is not one here.
138 if (is_keyed_load) {
139 key()->Push(masm);
140 Handle<Code> ic(Builtins::builtin(Builtins::KeyedLoadIC_Initialize));
141 __ call(ic, RelocInfo::CODE_TARGET);
142 __ pop(ebx); // Discard key.
143 } else {
144 key()->Get(masm, ecx);
145 Handle<Code> ic(Builtins::builtin(Builtins::LoadIC_Initialize));
146 __ call(ic, RelocInfo::CODE_TARGET);
147 }
148 __ pop(ebx); // Discard receiver.
149 location()->Set(masm, eax);
150 }
151
152
116 void BinaryOpInstr::Compile(MacroAssembler* masm) { 153 void BinaryOpInstr::Compile(MacroAssembler* masm) {
117 // The right-hand value should not be on the stack---if it is a 154 // The right-hand value should not be on the stack---if it is a
118 // compiler-generated temporary it is in the accumulator. 155 // compiler-generated temporary it is in the accumulator.
119 ASSERT(!value1()->is_on_stack()); 156 ASSERT(!right()->is_on_stack());
120 157
121 Comment cmnt(masm, "[ BinaryOpInstr"); 158 Comment cmnt(masm, "[ BinaryOpInstr");
122 // We can overwrite one of the operands if it is a temporary. 159 // We can overwrite one of the operands if it is a temporary.
123 OverwriteMode mode = NO_OVERWRITE; 160 OverwriteMode mode = NO_OVERWRITE;
124 if (value0()->is_temporary()) { 161 if (left()->is_temporary()) {
125 mode = OVERWRITE_LEFT; 162 mode = OVERWRITE_LEFT;
126 } else if (value1()->is_temporary()) { 163 } else if (right()->is_temporary()) {
127 mode = OVERWRITE_RIGHT; 164 mode = OVERWRITE_RIGHT;
128 } 165 }
129 166
130 // Push both operands and call the specialized stub. 167 // Push both operands and call the specialized stub.
131 if (!value0()->is_on_stack()) { 168 if (!left()->is_on_stack()) left()->Push(masm);
132 value0()->Push(masm); 169 right()->Push(masm);
133 }
134 value1()->Push(masm);
135 GenericBinaryOpStub stub(op(), mode, SMI_CODE_IN_STUB); 170 GenericBinaryOpStub stub(op(), mode, SMI_CODE_IN_STUB);
136 __ CallStub(&stub); 171 __ CallStub(&stub);
137 location()->Set(masm, eax); 172 location()->Set(masm, eax);
138 } 173 }
139 174
140 175
141 void ReturnInstr::Compile(MacroAssembler* masm) { 176 void ReturnInstr::Compile(MacroAssembler* masm) {
142 // The location should be 'Effect'. As a side effect, move the value to 177 // The location should be 'Effect'. As a side effect, move the value to
143 // the accumulator. 178 // the accumulator.
144 Comment cmnt(masm, "[ ReturnInstr"); 179 Comment cmnt(masm, "[ ReturnInstr");
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 break; 306 break;
272 case NOT_ALLOCATED: 307 case NOT_ALLOCATED:
273 UNREACHABLE(); 308 UNREACHABLE();
274 } 309 }
275 } 310 }
276 311
277 312
278 #undef __ 313 #undef __
279 314
280 } } // namespace v8::internal 315 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698