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

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

Issue 6577036: [Isolates] Merge from bleeding_edge to isolates, revisions 6100-6300. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 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/disasm-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 UNREACHABLE(); // Not used on IA32. 380 UNREACHABLE(); // Not used on IA32.
373 } 381 }
374 382
375 383
376 void FullCodeGenerator::EffectContext::Plug(Handle<Object> lit) const { 384 void FullCodeGenerator::EffectContext::Plug(Handle<Object> lit) const {
377 } 385 }
378 386
379 387
380 void FullCodeGenerator::AccumulatorValueContext::Plug( 388 void FullCodeGenerator::AccumulatorValueContext::Plug(
381 Handle<Object> lit) const { 389 Handle<Object> lit) const {
382 __ mov(result_register(), lit); 390 __ Set(result_register(), Immediate(lit));
383 } 391 }
384 392
385 393
386 void FullCodeGenerator::StackValueContext::Plug(Handle<Object> lit) const { 394 void FullCodeGenerator::StackValueContext::Plug(Handle<Object> lit) const {
387 // Immediates can be pushed directly. 395 // Immediates can be pushed directly.
388 __ push(Immediate(lit)); 396 __ push(Immediate(lit));
389 } 397 }
390 398
391 399
392 void FullCodeGenerator::TestContext::Plug(Handle<Object> lit) const { 400 void FullCodeGenerator::TestContext::Plug(Handle<Object> lit) const {
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 VisitForAccumulatorValue(property->obj()); 1508 VisitForAccumulatorValue(property->obj());
1501 __ push(result_register()); 1509 __ push(result_register());
1502 } else { 1510 } else {
1503 VisitForStackValue(property->obj()); 1511 VisitForStackValue(property->obj());
1504 } 1512 }
1505 break; 1513 break;
1506 case KEYED_PROPERTY: { 1514 case KEYED_PROPERTY: {
1507 if (expr->is_compound()) { 1515 if (expr->is_compound()) {
1508 if (property->is_arguments_access()) { 1516 if (property->is_arguments_access()) {
1509 VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); 1517 VariableProxy* obj_proxy = property->obj()->AsVariableProxy();
1510 __ push(EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx)); 1518 MemOperand slot_operand =
1519 EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx);
1520 __ push(slot_operand);
1511 __ mov(eax, Immediate(property->key()->AsLiteral()->handle())); 1521 __ mov(eax, Immediate(property->key()->AsLiteral()->handle()));
1512 } else { 1522 } else {
1513 VisitForStackValue(property->obj()); 1523 VisitForStackValue(property->obj());
1514 VisitForAccumulatorValue(property->key()); 1524 VisitForAccumulatorValue(property->key());
1515 } 1525 }
1516 __ mov(edx, Operand(esp, 0)); 1526 __ mov(edx, Operand(esp, 0));
1517 __ push(eax); 1527 __ push(eax);
1518 } else { 1528 } else {
1519 if (property->is_arguments_access()) { 1529 if (property->is_arguments_access()) {
1520 VariableProxy* obj_proxy = property->obj()->AsVariableProxy(); 1530 VariableProxy* obj_proxy = property->obj()->AsVariableProxy();
1521 __ push(EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx)); 1531 MemOperand slot_operand =
1532 EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx);
1533 __ push(slot_operand);
1522 __ push(Immediate(property->key()->AsLiteral()->handle())); 1534 __ push(Immediate(property->key()->AsLiteral()->handle()));
1523 } else { 1535 } else {
1524 VisitForStackValue(property->obj()); 1536 VisitForStackValue(property->obj());
1525 VisitForStackValue(property->key()); 1537 VisitForStackValue(property->key());
1526 } 1538 }
1527 } 1539 }
1528 break; 1540 break;
1529 } 1541 }
1530 } 1542 }
1531 1543
(...skipping 2223 matching lines...) Expand 10 before | Expand all | Expand 10 after
3755 __ push(Immediate(Smi::FromInt(0))); 3767 __ push(Immediate(Smi::FromInt(0)));
3756 } 3768 }
3757 if (assign_type == NAMED_PROPERTY) { 3769 if (assign_type == NAMED_PROPERTY) {
3758 // Put the object both on the stack and in the accumulator. 3770 // Put the object both on the stack and in the accumulator.
3759 VisitForAccumulatorValue(prop->obj()); 3771 VisitForAccumulatorValue(prop->obj());
3760 __ push(eax); 3772 __ push(eax);
3761 EmitNamedPropertyLoad(prop); 3773 EmitNamedPropertyLoad(prop);
3762 } else { 3774 } else {
3763 if (prop->is_arguments_access()) { 3775 if (prop->is_arguments_access()) {
3764 VariableProxy* obj_proxy = prop->obj()->AsVariableProxy(); 3776 VariableProxy* obj_proxy = prop->obj()->AsVariableProxy();
3765 __ push(EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx)); 3777 MemOperand slot_operand =
3778 EmitSlotSearch(obj_proxy->var()->AsSlot(), ecx);
3779 __ push(slot_operand);
3766 __ mov(eax, Immediate(prop->key()->AsLiteral()->handle())); 3780 __ mov(eax, Immediate(prop->key()->AsLiteral()->handle()));
3767 } else { 3781 } else {
3768 VisitForStackValue(prop->obj()); 3782 VisitForStackValue(prop->obj());
3769 VisitForAccumulatorValue(prop->key()); 3783 VisitForAccumulatorValue(prop->key());
3770 } 3784 }
3771 __ mov(edx, Operand(esp, 0)); 3785 __ mov(edx, Operand(esp, 0));
3772 __ push(eax); 3786 __ push(eax);
3773 EmitKeyedPropertyLoad(prop); 3787 EmitKeyedPropertyLoad(prop);
3774 } 3788 }
3775 } 3789 }
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
4061 case Token::IN: 4075 case Token::IN:
4062 VisitForStackValue(expr->right()); 4076 VisitForStackValue(expr->right());
4063 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION); 4077 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION);
4064 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL); 4078 PrepareForBailoutBeforeSplit(TOS_REG, false, NULL, NULL);
4065 __ cmp(eax, isolate()->factory()->true_value()); 4079 __ cmp(eax, isolate()->factory()->true_value());
4066 Split(equal, if_true, if_false, fall_through); 4080 Split(equal, if_true, if_false, fall_through);
4067 break; 4081 break;
4068 4082
4069 case Token::INSTANCEOF: { 4083 case Token::INSTANCEOF: {
4070 VisitForStackValue(expr->right()); 4084 VisitForStackValue(expr->right());
4071 __ IncrementCounter(COUNTERS->instance_of_full(), 1);
4072 InstanceofStub stub(InstanceofStub::kNoFlags); 4085 InstanceofStub stub(InstanceofStub::kNoFlags);
4073 __ CallStub(&stub); 4086 __ CallStub(&stub);
4074 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); 4087 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false);
4075 __ test(eax, Operand(eax)); 4088 __ test(eax, Operand(eax));
4076 // The stub returns 0 for true. 4089 // The stub returns 0 for true.
4077 Split(zero, if_true, if_false, fall_through); 4090 Split(zero, if_true, if_false, fall_through);
4078 break; 4091 break;
4079 } 4092 }
4080 4093
4081 default: { 4094 default: {
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4286 // And return. 4299 // And return.
4287 __ ret(0); 4300 __ ret(0);
4288 } 4301 }
4289 4302
4290 4303
4291 #undef __ 4304 #undef __
4292 4305
4293 } } // namespace v8::internal 4306 } } // namespace v8::internal
4294 4307
4295 #endif // V8_TARGET_ARCH_IA32 4308 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/disasm-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698