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

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

Issue 6113004: Version 3.0.7 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 9 years, 11 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 | « src/ia32/deoptimizer-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 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
11 // with the distribution. 11 // with the distribution.
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 258
259 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) { 259 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt) {
260 Comment cmnt(masm_, "[ Stack check"); 260 Comment cmnt(masm_, "[ Stack check");
261 NearLabel ok; 261 NearLabel ok;
262 ExternalReference stack_limit = ExternalReference::address_of_stack_limit(); 262 ExternalReference stack_limit = ExternalReference::address_of_stack_limit();
263 __ cmp(esp, Operand::StaticVariable(stack_limit)); 263 __ cmp(esp, Operand::StaticVariable(stack_limit));
264 __ j(above_equal, &ok, taken); 264 __ j(above_equal, &ok, taken);
265 StackCheckStub stub; 265 StackCheckStub stub;
266 __ CallStub(&stub); 266 __ CallStub(&stub);
267 // Record a mapping of this PC offset to the OSR id. This is used to find
268 // the AST id from the unoptimized code in order to use it as a key into
269 // the deoptimization input data found in the optimized code.
270 RecordStackCheck(stmt->OsrEntryId());
271
272 // Loop stack checks can be patched to perform on-stack replacement. In
273 // order to decide whether or not to perform OSR we embed the loop depth
274 // in a test instruction after the call so we can extract it from the OSR
275 // builtin.
276 ASSERT(loop_depth() > 0);
277 __ test(eax, Immediate(Min(loop_depth(), Code::kMaxLoopNestingMarker)));
278
267 __ bind(&ok); 279 __ bind(&ok);
268 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); 280 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
281 // Record a mapping of the OSR id to this PC. This is used if the OSR
282 // entry becomes the target of a bailout. We don't expect it to be, but
283 // we want it to work if it is.
269 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); 284 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS);
270 RecordStackCheck(stmt->OsrEntryId());
271 // Loop stack checks can be patched to perform on-stack
272 // replacement. In order to decide whether or not to perform OSR we
273 // embed the loop depth in a test instruction after the call so we
274 // can extract it from the OSR builtin.
275 ASSERT(loop_depth() > 0);
276 __ test(eax, Immediate(Min(loop_depth(), Code::kMaxLoopNestingMarker)));
277 } 285 }
278 286
279 287
280 void FullCodeGenerator::EmitReturnSequence() { 288 void FullCodeGenerator::EmitReturnSequence() {
281 Comment cmnt(masm_, "[ Return sequence"); 289 Comment cmnt(masm_, "[ Return sequence");
282 if (return_label_.is_bound()) { 290 if (return_label_.is_bound()) {
283 __ jmp(&return_label_); 291 __ jmp(&return_label_);
284 } else { 292 } else {
285 // Common return label 293 // Common return label
286 __ bind(&return_label_); 294 __ bind(&return_label_);
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 VisitForAccumulatorValue(property->obj()); 1498 VisitForAccumulatorValue(property->obj());
1491 __ push(result_register()); 1499 __ push(result_register());
1492 } else { 1500 } else {
1493 VisitForStackValue(property->obj()); 1501 VisitForStackValue(property->obj());
1494 } 1502 }
1495 break; 1503 break;
1496 case KEYED_PROPERTY: { 1504 case KEYED_PROPERTY: {
1497 if (expr->is_compound()) { 1505 if (expr->is_compound()) {
1498 if (property->is_arguments_access()) { 1506 if (property->is_arguments_access()) {
1499 VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); 1507 VariableProxy* obj_proxy = property->obj()->AsVariableProxy();
1500 __ push(EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx)); 1508 MemOperand slot_operand =
1509 EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx);
1510 __ push(slot_operand);
1501 __ mov(eax, Immediate(property->key()->AsLiteral()->handle())); 1511 __ mov(eax, Immediate(property->key()->AsLiteral()->handle()));
1502 } else { 1512 } else {
1503 VisitForStackValue(property->obj()); 1513 VisitForStackValue(property->obj());
1504 VisitForAccumulatorValue(property->key()); 1514 VisitForAccumulatorValue(property->key());
1505 } 1515 }
1506 __ mov(edx, Operand(esp, 0)); 1516 __ mov(edx, Operand(esp, 0));
1507 __ push(eax); 1517 __ push(eax);
1508 } else { 1518 } else {
1509 if (property->is_arguments_access()) { 1519 if (property->is_arguments_access()) {
1510 VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); 1520 VariableProxy* obj_proxy = property->obj()->AsVariableProxy();
1511 __ push(EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx)); 1521 MemOperand slot_operand =
1522 EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx);
1523 __ push(slot_operand);
1512 __ push(Immediate(property->key()->AsLiteral()->handle())); 1524 __ push(Immediate(property->key()->AsLiteral()->handle()));
1513 } else { 1525 } else {
1514 VisitForStackValue(property->obj()); 1526 VisitForStackValue(property->obj());
1515 VisitForStackValue(property->key()); 1527 VisitForStackValue(property->key());
1516 } 1528 }
1517 } 1529 }
1518 break; 1530 break;
1519 } 1531 }
1520 } 1532 }
1521 1533
(...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after
3732 __ push(Immediate(Smi::FromInt(0))); 3744 __ push(Immediate(Smi::FromInt(0)));
3733 } 3745 }
3734 if (assign_type == NAMED_PROPERTY) { 3746 if (assign_type == NAMED_PROPERTY) {
3735 // Put the object both on the stack and in the accumulator. 3747 // Put the object both on the stack and in the accumulator.
3736 VisitForAccumulatorValue(prop->obj()); 3748 VisitForAccumulatorValue(prop->obj());
3737 __ push(eax); 3749 __ push(eax);
3738 EmitNamedPropertyLoad(prop); 3750 EmitNamedPropertyLoad(prop);
3739 } else { 3751 } else {
3740 if (prop->is_arguments_access()) { 3752 if (prop->is_arguments_access()) {
3741 VariableProxy* obj_proxy = prop->obj()->AsVariableProxy(); 3753 VariableProxy* obj_proxy = prop->obj()->AsVariableProxy();
3742 __ push(EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx)); 3754 MemOperand slot_operand =
3755 EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx);
3756 __ push(slot_operand);
3743 __ mov(eax, Immediate(prop->key()->AsLiteral()->handle())); 3757 __ mov(eax, Immediate(prop->key()->AsLiteral()->handle()));
3744 } else { 3758 } else {
3745 VisitForStackValue(prop->obj()); 3759 VisitForStackValue(prop->obj());
3746 VisitForAccumulatorValue(prop->key()); 3760 VisitForAccumulatorValue(prop->key());
3747 } 3761 }
3748 __ mov(edx, Operand(esp, 0)); 3762 __ mov(edx, Operand(esp, 0));
3749 __ push(eax); 3763 __ push(eax);
3750 EmitKeyedPropertyLoad(prop); 3764 EmitKeyedPropertyLoad(prop);
3751 } 3765 }
3752 } 3766 }
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
4035 case Token::IN: 4049 case Token::IN:
4036 VisitForStackValue(expr->right()); 4050 VisitForStackValue(expr->right());
4037 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION); 4051 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION);
4038 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); 4052 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
4039 __ cmp(eax, Factory::true_value()); 4053 __ cmp(eax, Factory::true_value());
4040 Split(equal, if_true, if_false, fall_through); 4054 Split(equal, if_true, if_false, fall_through);
4041 break; 4055 break;
4042 4056
4043 case Token::INSTANCEOF: { 4057 case Token::INSTANCEOF: {
4044 VisitForStackValue(expr->right()); 4058 VisitForStackValue(expr->right());
4045 __ IncrementCounter(&Counters::instance_of_full, 1);
4046 InstanceofStub stub(InstanceofStub::kNoFlags); 4059 InstanceofStub stub(InstanceofStub::kNoFlags);
4047 __ CallStub(&stub); 4060 __ CallStub(&stub);
4048 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); 4061 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
4049 __ test(eax, Operand(eax)); 4062 __ test(eax, Operand(eax));
4050 // The stub returns 0 for true. 4063 // The stub returns 0 for true.
4051 Split(zero, if_true, if_false, fall_through); 4064 Split(zero, if_true, if_false, fall_through);
4052 break; 4065 break;
4053 } 4066 }
4054 4067
4055 default: { 4068 default: {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4260 // And return. 4273 // And return.
4261 __ ret(0); 4274 __ ret(0);
4262 } 4275 }
4263 4276
4264 4277
4265 #undef __ 4278 #undef __
4266 4279
4267 } } // namespace v8::internal 4280 } } // namespace v8::internal
4268 4281
4269 #endif // V8_TARGET_ARCH_IA32 4282 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/deoptimizer-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698