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

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

Issue 8960004: Avoid embedding new space objects into code objects in the lithium gap resolver. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 return literal; 347 return literal;
348 } 348 }
349 349
350 350
351 double LCodeGen::ToDouble(LConstantOperand* op) const { 351 double LCodeGen::ToDouble(LConstantOperand* op) const {
352 Handle<Object> value = chunk_->LookupLiteral(op); 352 Handle<Object> value = chunk_->LookupLiteral(op);
353 return value->Number(); 353 return value->Number();
354 } 354 }
355 355
356 356
357 Immediate LCodeGen::ToImmediate(LOperand* op) { 357 bool LCodeGen::IsInteger32(LConstantOperand* op) const {
358 LConstantOperand* const_op = LConstantOperand::cast(op); 358 return chunk_->LookupLiteralRepresentation(op).IsInteger32();
359 Handle<Object> literal = chunk_->LookupLiteral(const_op);
360 Representation r = chunk_->LookupLiteralRepresentation(const_op);
361 if (r.IsInteger32()) {
362 ASSERT(literal->IsNumber());
363 return Immediate(static_cast<int32_t>(literal->Number()));
364 } else if (r.IsDouble()) {
365 Abort("unsupported double immediate");
366 }
367 ASSERT(r.IsTagged());
368 return Immediate(literal);
369 } 359 }
370 360
371 361
372 Operand LCodeGen::ToOperand(LOperand* op) const { 362 Operand LCodeGen::ToOperand(LOperand* op) const {
373 if (op->IsRegister()) return Operand(ToRegister(op)); 363 if (op->IsRegister()) return Operand(ToRegister(op));
374 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op)); 364 if (op->IsDoubleRegister()) return Operand(ToDoubleRegister(op));
375 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot()); 365 ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
376 int index = op->index(); 366 int index = op->index();
377 if (index >= 0) { 367 if (index >= 0) {
378 // Local or spill slot. Skip the frame pointer, function, and 368 // Local or spill slot. Skip the frame pointer, function, and
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 } 1150 }
1161 } 1151 }
1162 1152
1163 1153
1164 void LCodeGen::DoSubI(LSubI* instr) { 1154 void LCodeGen::DoSubI(LSubI* instr) {
1165 LOperand* left = instr->InputAt(0); 1155 LOperand* left = instr->InputAt(0);
1166 LOperand* right = instr->InputAt(1); 1156 LOperand* right = instr->InputAt(1);
1167 ASSERT(left->Equals(instr->result())); 1157 ASSERT(left->Equals(instr->result()));
1168 1158
1169 if (right->IsConstantOperand()) { 1159 if (right->IsConstantOperand()) {
1170 __ sub(ToOperand(left), ToImmediate(right)); 1160 __ sub(ToOperand(left), ToInteger32Immediate(right));
1171 } else { 1161 } else {
1172 __ sub(ToRegister(left), ToOperand(right)); 1162 __ sub(ToRegister(left), ToOperand(right));
1173 } 1163 }
1174 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { 1164 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1175 DeoptimizeIf(overflow, instr->environment()); 1165 DeoptimizeIf(overflow, instr->environment());
1176 } 1166 }
1177 } 1167 }
1178 1168
1179 1169
1180 void LCodeGen::DoConstantI(LConstantI* instr) { 1170 void LCodeGen::DoConstantI(LConstantI* instr) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 } 1289 }
1300 } 1290 }
1301 1291
1302 1292
1303 void LCodeGen::DoAddI(LAddI* instr) { 1293 void LCodeGen::DoAddI(LAddI* instr) {
1304 LOperand* left = instr->InputAt(0); 1294 LOperand* left = instr->InputAt(0);
1305 LOperand* right = instr->InputAt(1); 1295 LOperand* right = instr->InputAt(1);
1306 ASSERT(left->Equals(instr->result())); 1296 ASSERT(left->Equals(instr->result()));
1307 1297
1308 if (right->IsConstantOperand()) { 1298 if (right->IsConstantOperand()) {
1309 __ add(ToOperand(left), ToImmediate(right)); 1299 __ add(ToOperand(left), ToInteger32Immediate(right));
1310 } else { 1300 } else {
1311 __ add(ToRegister(left), ToOperand(right)); 1301 __ add(ToRegister(left), ToOperand(right));
1312 } 1302 }
1313 1303
1314 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) { 1304 if (instr->hydrogen()->CheckFlag(HValue::kCanOverflow)) {
1315 DeoptimizeIf(overflow, instr->environment()); 1305 DeoptimizeIf(overflow, instr->environment());
1316 } 1306 }
1317 } 1307 }
1318 1308
1319 1309
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 : false_block; 1561 : false_block;
1572 EmitGoto(next_block); 1562 EmitGoto(next_block);
1573 } else { 1563 } else {
1574 if (instr->is_double()) { 1564 if (instr->is_double()) {
1575 // Don't base result on EFLAGS when a NaN is involved. Instead 1565 // Don't base result on EFLAGS when a NaN is involved. Instead
1576 // jump to the false block. 1566 // jump to the false block.
1577 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right)); 1567 __ ucomisd(ToDoubleRegister(left), ToDoubleRegister(right));
1578 __ j(parity_even, chunk_->GetAssemblyLabel(false_block)); 1568 __ j(parity_even, chunk_->GetAssemblyLabel(false_block));
1579 } else { 1569 } else {
1580 if (right->IsConstantOperand()) { 1570 if (right->IsConstantOperand()) {
1581 __ cmp(ToRegister(left), ToImmediate(right)); 1571 __ cmp(ToRegister(left), ToInteger32Immediate(right));
1582 } else if (left->IsConstantOperand()) { 1572 } else if (left->IsConstantOperand()) {
1583 __ cmp(ToOperand(right), ToImmediate(left)); 1573 __ cmp(ToOperand(right), ToInteger32Immediate(left));
1584 // We transposed the operands. Reverse the condition. 1574 // We transposed the operands. Reverse the condition.
1585 cc = ReverseCondition(cc); 1575 cc = ReverseCondition(cc);
1586 } else { 1576 } else {
1587 __ cmp(ToRegister(left), ToOperand(right)); 1577 __ cmp(ToRegister(left), ToOperand(right));
1588 } 1578 }
1589 } 1579 }
1590 EmitBranch(true_block, false_block, cc); 1580 EmitBranch(true_block, false_block, cc);
1591 } 1581 }
1592 } 1582 }
1593 1583
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
3254 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) 3244 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode)
3255 ? isolate()->builtins()->StoreIC_Initialize_Strict() 3245 ? isolate()->builtins()->StoreIC_Initialize_Strict()
3256 : isolate()->builtins()->StoreIC_Initialize(); 3246 : isolate()->builtins()->StoreIC_Initialize();
3257 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3247 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3258 } 3248 }
3259 3249
3260 3250
3261 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 3251 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
3262 if (instr->index()->IsConstantOperand()) { 3252 if (instr->index()->IsConstantOperand()) {
3263 __ cmp(ToOperand(instr->length()), 3253 __ cmp(ToOperand(instr->length()),
3264 ToImmediate(LConstantOperand::cast(instr->index()))); 3254 Immediate(ToInteger32(LConstantOperand::cast(instr->index()))));
3265 DeoptimizeIf(below_equal, instr->environment()); 3255 DeoptimizeIf(below_equal, instr->environment());
3266 } else { 3256 } else {
3267 __ cmp(ToRegister(instr->index()), ToOperand(instr->length())); 3257 __ cmp(ToRegister(instr->index()), ToOperand(instr->length()));
3268 DeoptimizeIf(above_equal, instr->environment()); 3258 DeoptimizeIf(above_equal, instr->environment());
3269 } 3259 }
3270 } 3260 }
3271 3261
3272 3262
3273 void LCodeGen::DoStoreKeyedSpecializedArrayElement( 3263 void LCodeGen::DoStoreKeyedSpecializedArrayElement(
3274 LStoreKeyedSpecializedArrayElement* instr) { 3264 LStoreKeyedSpecializedArrayElement* instr) {
(...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after
4629 this, pointers, Safepoint::kLazyDeopt); 4619 this, pointers, Safepoint::kLazyDeopt);
4630 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); 4620 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator);
4631 } 4621 }
4632 4622
4633 4623
4634 #undef __ 4624 #undef __
4635 4625
4636 } } // namespace v8::internal 4626 } } // namespace v8::internal
4637 4627
4638 #endif // V8_TARGET_ARCH_IA32 4628 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698