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

Side by Side Diff: src/ia32/lithium-ia32.cc

Issue 5990005: Optimize instanceof further... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 12 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 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 bool needs_environment = 831 bool needs_environment =
832 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || !hinstr->HasSideEffects(); 832 (can_deoptimize == CAN_DEOPTIMIZE_EAGERLY) || !hinstr->HasSideEffects();
833 if (needs_environment && !instr->HasEnvironment()) { 833 if (needs_environment && !instr->HasEnvironment()) {
834 instr = AssignEnvironment(instr); 834 instr = AssignEnvironment(instr);
835 } 835 }
836 836
837 return instr; 837 return instr;
838 } 838 }
839 839
840 840
841 LInstruction* LChunkBuilder::MarkAsSaveDoubles(LInstruction* instr) {
842 allocator_->MarkAsSaveDoubles();
843 return instr;
844 }
845
846
841 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) { 847 LInstruction* LChunkBuilder::AssignPointerMap(LInstruction* instr) {
842 ASSERT(!instr->HasPointerMap()); 848 ASSERT(!instr->HasPointerMap());
843 instr->set_pointer_map(new LPointerMap(position_)); 849 instr->set_pointer_map(new LPointerMap(position_));
844 return instr; 850 return instr;
845 } 851 }
846 852
847 853
848 LInstruction* LChunkBuilder::Define(LInstruction* instr, LUnallocated* result) { 854 LInstruction* LChunkBuilder::Define(LInstruction* instr, LUnallocated* result) {
849 allocator_->RecordDefinition(current_instruction_, result); 855 allocator_->RecordDefinition(current_instruction_, result);
850 instr->set_result(result); 856 instr->set_result(result);
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 second_id); 1264 second_id);
1259 } else if (v->IsCompareJSObjectEq()) { 1265 } else if (v->IsCompareJSObjectEq()) {
1260 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v); 1266 HCompareJSObjectEq* compare = HCompareJSObjectEq::cast(v);
1261 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()), 1267 return new LCmpJSObjectEqAndBranch(UseRegisterAtStart(compare->left()),
1262 UseRegisterAtStart(compare->right()), 1268 UseRegisterAtStart(compare->right()),
1263 first_id, 1269 first_id,
1264 second_id); 1270 second_id);
1265 } else if (v->IsInstanceOf()) { 1271 } else if (v->IsInstanceOf()) {
1266 HInstanceOf* instance_of = HInstanceOf::cast(v); 1272 HInstanceOf* instance_of = HInstanceOf::cast(v);
1267 LInstruction* result = 1273 LInstruction* result =
1268 new LInstanceOfAndBranch(UseFixed(instance_of->left(), eax), 1274 new LInstanceOfAndBranch(
1269 UseFixed(instance_of->right(), edx), 1275 UseFixed(instance_of->left(), InstanceofStub::left()),
1270 first_id, 1276 UseFixed(instance_of->right(), InstanceofStub::right()),
1271 second_id); 1277 first_id,
1278 second_id);
1272 return MarkAsCall(result, instr); 1279 return MarkAsCall(result, instr);
1273 } else if (v->IsTypeofIs()) { 1280 } else if (v->IsTypeofIs()) {
1274 HTypeofIs* typeof_is = HTypeofIs::cast(v); 1281 HTypeofIs* typeof_is = HTypeofIs::cast(v);
1275 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()), 1282 return new LTypeofIsAndBranch(UseTempRegister(typeof_is->value()),
1276 first_id, 1283 first_id,
1277 second_id); 1284 second_id);
1278 } else { 1285 } else {
1279 if (v->IsConstant()) { 1286 if (v->IsConstant()) {
1280 if (HConstant::cast(v)->handle()->IsTrue()) { 1287 if (HConstant::cast(v)->handle()->IsTrue()) {
1281 return new LGoto(first_id); 1288 return new LGoto(first_id);
(...skipping 27 matching lines...) Expand all
1309 } 1316 }
1310 1317
1311 1318
1312 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) { 1319 LInstruction* LChunkBuilder::DoArgumentsElements(HArgumentsElements* elems) {
1313 return DefineAsRegister(new LArgumentsElements); 1320 return DefineAsRegister(new LArgumentsElements);
1314 } 1321 }
1315 1322
1316 1323
1317 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) { 1324 LInstruction* LChunkBuilder::DoInstanceOf(HInstanceOf* instr) {
1318 LInstruction* result = 1325 LInstruction* result =
1319 new LInstanceOf(UseFixed(instr->left(), eax), 1326 new LInstanceOf(UseFixed(instr->left(), InstanceofStub::left()),
1320 UseFixed(instr->right(), edx)); 1327 UseFixed(instr->right(), InstanceofStub::right()));
1321 return MarkAsCall(DefineFixed(result, eax), instr); 1328 return MarkAsCall(DefineFixed(result, eax), instr);
1322 } 1329 }
1323 1330
1324 1331
1332 LInstruction* LChunkBuilder::DoInstanceOfKnownGlobal(
1333 HInstanceOfKnownGlobal* instr) {
1334 LInstruction* result =
1335 new LInstanceOfKnownGlobal(
1336 UseFixed(instr->value(), InstanceofStub::left()),
1337 FixedTemp(edi));
1338 MarkAsSaveDoubles(result);
1339 return AssignEnvironment(AssignPointerMap(DefineFixed(result, eax)));
1340 }
1341
1342
1325 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) { 1343 LInstruction* LChunkBuilder::DoApplyArguments(HApplyArguments* instr) {
1326 LOperand* function = UseFixed(instr->function(), edi); 1344 LOperand* function = UseFixed(instr->function(), edi);
1327 LOperand* receiver = UseFixed(instr->receiver(), eax); 1345 LOperand* receiver = UseFixed(instr->receiver(), eax);
1328 LOperand* length = UseRegisterAtStart(instr->length()); 1346 LOperand* length = UseRegisterAtStart(instr->length());
1329 LOperand* elements = UseRegisterAtStart(instr->elements()); 1347 LOperand* elements = UseRegisterAtStart(instr->elements());
1330 LInstruction* result = new LApplyArguments(function, 1348 LInstruction* result = new LApplyArguments(function,
1331 receiver, 1349 receiver,
1332 length, 1350 length,
1333 elements); 1351 elements);
1334 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY); 1352 return MarkAsCall(DefineFixed(result, eax), instr, CAN_DEOPTIMIZE_EAGERLY);
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 void LPointerMap::PrintTo(StringStream* stream) const { 2137 void LPointerMap::PrintTo(StringStream* stream) const {
2120 stream->Add("{"); 2138 stream->Add("{");
2121 for (int i = 0; i < pointer_operands_.length(); ++i) { 2139 for (int i = 0; i < pointer_operands_.length(); ++i) {
2122 if (i != 0) stream->Add(";"); 2140 if (i != 0) stream->Add(";");
2123 pointer_operands_[i]->PrintTo(stream); 2141 pointer_operands_[i]->PrintTo(stream);
2124 } 2142 }
2125 stream->Add("} @%d", position()); 2143 stream->Add("} @%d", position());
2126 } 2144 }
2127 2145
2128 } } // namespace v8::internal 2146 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698