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

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

Issue 12317141: Added Isolate parameter to CodeStub::GetCode(). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed whitespace. Rebased. Created 7 years, 9 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/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 988
989 __ cmp(edx, eax); 989 __ cmp(edx, eax);
990 __ j(not_equal, &next_test); 990 __ j(not_equal, &next_test);
991 __ Drop(1); // Switch value is no longer needed. 991 __ Drop(1); // Switch value is no longer needed.
992 __ jmp(clause->body_target()); 992 __ jmp(clause->body_target());
993 __ bind(&slow_case); 993 __ bind(&slow_case);
994 } 994 }
995 995
996 // Record position before stub call for type feedback. 996 // Record position before stub call for type feedback.
997 SetSourcePosition(clause->position()); 997 SetSourcePosition(clause->position());
998 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); 998 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), Token::EQ_STRICT);
999 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); 999 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId());
1000 patch_site.EmitPatchInfo(); 1000 patch_site.EmitPatchInfo();
1001 __ test(eax, eax); 1001 __ test(eax, eax);
1002 __ j(not_equal, &next_test); 1002 __ j(not_equal, &next_test);
1003 __ Drop(1); // Switch value is no longer needed. 1003 __ Drop(1); // Switch value is no longer needed.
1004 __ jmp(clause->body_target()); 1004 __ jmp(clause->body_target());
1005 } 1005 }
1006 1006
1007 // Discard the test value and jump to the default if present, otherwise to 1007 // Discard the test value and jump to the default if present, otherwise to
1008 // the end of the statement. 1008 // the end of the statement.
(...skipping 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 Label smi_case, done, stub_call; 1895 Label smi_case, done, stub_call;
1896 __ pop(edx); 1896 __ pop(edx);
1897 __ mov(ecx, eax); 1897 __ mov(ecx, eax);
1898 __ or_(eax, edx); 1898 __ or_(eax, edx);
1899 JumpPatchSite patch_site(masm_); 1899 JumpPatchSite patch_site(masm_);
1900 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear); 1900 patch_site.EmitJumpIfSmi(eax, &smi_case, Label::kNear);
1901 1901
1902 __ bind(&stub_call); 1902 __ bind(&stub_call);
1903 __ mov(eax, ecx); 1903 __ mov(eax, ecx);
1904 BinaryOpStub stub(op, mode); 1904 BinaryOpStub stub(op, mode);
1905 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, 1905 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
1906 expr->BinaryOperationFeedbackId()); 1906 expr->BinaryOperationFeedbackId());
1907 patch_site.EmitPatchInfo(); 1907 patch_site.EmitPatchInfo();
1908 __ jmp(&done, Label::kNear); 1908 __ jmp(&done, Label::kNear);
1909 1909
1910 // Smi case. 1910 // Smi case.
1911 __ bind(&smi_case); 1911 __ bind(&smi_case);
1912 __ mov(eax, edx); // Copy left operand in case of a stub call. 1912 __ mov(eax, edx); // Copy left operand in case of a stub call.
1913 1913
1914 switch (op) { 1914 switch (op) {
1915 case Token::SAR: 1915 case Token::SAR:
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1981 context()->Plug(eax); 1981 context()->Plug(eax);
1982 } 1982 }
1983 1983
1984 1984
1985 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 1985 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
1986 Token::Value op, 1986 Token::Value op,
1987 OverwriteMode mode) { 1987 OverwriteMode mode) {
1988 __ pop(edx); 1988 __ pop(edx);
1989 BinaryOpStub stub(op, mode); 1989 BinaryOpStub stub(op, mode);
1990 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 1990 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
1991 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, 1991 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
1992 expr->BinaryOperationFeedbackId()); 1992 expr->BinaryOperationFeedbackId());
1993 patch_site.EmitPatchInfo(); 1993 patch_site.EmitPatchInfo();
1994 context()->Plug(eax); 1994 context()->Plug(eax);
1995 } 1995 }
1996 1996
1997 1997
1998 void FullCodeGenerator::EmitAssignment(Expression* expr) { 1998 void FullCodeGenerator::EmitAssignment(Expression* expr) {
1999 // Invalid left-hand sides are rewritten by the parser to have a 'throw 1999 // Invalid left-hand sides are rewritten by the parser to have a 'throw
2000 // ReferenceError' on the left-hand side. 2000 // ReferenceError' on the left-hand side.
2001 if (!expr->IsValidLeftHandSide()) { 2001 if (!expr->IsValidLeftHandSide()) {
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 2472
2473 // Record call targets in unoptimized code. 2473 // Record call targets in unoptimized code.
2474 Handle<Object> uninitialized = 2474 Handle<Object> uninitialized =
2475 TypeFeedbackCells::UninitializedSentinel(isolate()); 2475 TypeFeedbackCells::UninitializedSentinel(isolate());
2476 Handle<JSGlobalPropertyCell> cell = 2476 Handle<JSGlobalPropertyCell> cell =
2477 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); 2477 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized);
2478 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); 2478 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell);
2479 __ mov(ebx, cell); 2479 __ mov(ebx, cell);
2480 2480
2481 CallConstructStub stub(RECORD_CALL_TARGET); 2481 CallConstructStub stub(RECORD_CALL_TARGET);
2482 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 2482 __ call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL);
2483 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2483 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2484 context()->Plug(eax); 2484 context()->Plug(eax);
2485 } 2485 }
2486 2486
2487 2487
2488 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2488 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
2489 ZoneList<Expression*>* args = expr->arguments(); 2489 ZoneList<Expression*>* args = expr->arguments();
2490 ASSERT(args->length() == 1); 2490 ASSERT(args->length() == 1);
2491 2491
2492 VisitForAccumulatorValue(args->at(0)); 2492 VisitForAccumulatorValue(args->at(0));
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
3982 const char* comment) { 3982 const char* comment) {
3983 Comment cmt(masm_, comment); 3983 Comment cmt(masm_, comment);
3984 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); 3984 bool can_overwrite = expr->expression()->ResultOverwriteAllowed();
3985 UnaryOverwriteMode overwrite = 3985 UnaryOverwriteMode overwrite =
3986 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; 3986 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
3987 UnaryOpStub stub(expr->op(), overwrite); 3987 UnaryOpStub stub(expr->op(), overwrite);
3988 // UnaryOpStub expects the argument to be in the 3988 // UnaryOpStub expects the argument to be in the
3989 // accumulator register eax. 3989 // accumulator register eax.
3990 VisitForAccumulatorValue(expr->expression()); 3990 VisitForAccumulatorValue(expr->expression());
3991 SetSourcePosition(expr->position()); 3991 SetSourcePosition(expr->position());
3992 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, 3992 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
3993 expr->UnaryOperationFeedbackId()); 3993 expr->UnaryOperationFeedbackId());
3994 context()->Plug(eax); 3994 context()->Plug(eax);
3995 } 3995 }
3996 3996
3997 3997
3998 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { 3998 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
3999 Comment cmnt(masm_, "[ CountOperation"); 3999 Comment cmnt(masm_, "[ CountOperation");
4000 SetSourcePosition(expr->position()); 4000 SetSourcePosition(expr->position());
4001 4001
4002 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' 4002 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError'
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 } 4104 }
4105 } 4105 }
4106 4106
4107 // Record position before stub call. 4107 // Record position before stub call.
4108 SetSourcePosition(expr->position()); 4108 SetSourcePosition(expr->position());
4109 4109
4110 // Call stub for +1/-1. 4110 // Call stub for +1/-1.
4111 __ mov(edx, eax); 4111 __ mov(edx, eax);
4112 __ mov(eax, Immediate(Smi::FromInt(1))); 4112 __ mov(eax, Immediate(Smi::FromInt(1)));
4113 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); 4113 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE);
4114 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountBinOpFeedbackId()); 4114 CallIC(stub.GetCode(isolate()),
4115 RelocInfo::CODE_TARGET,
4116 expr->CountBinOpFeedbackId());
4115 patch_site.EmitPatchInfo(); 4117 patch_site.EmitPatchInfo();
4116 __ bind(&done); 4118 __ bind(&done);
4117 4119
4118 // Store the value returned in eax. 4120 // Store the value returned in eax.
4119 switch (assign_type) { 4121 switch (assign_type) {
4120 case VARIABLE: 4122 case VARIABLE:
4121 if (expr->is_postfix()) { 4123 if (expr->is_postfix()) {
4122 // Perform the assignment as if via '='. 4124 // Perform the assignment as if via '='.
4123 { EffectContext context(this); 4125 { EffectContext context(this);
4124 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4126 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
4340 __ mov(ecx, edx); 4342 __ mov(ecx, edx);
4341 __ or_(ecx, eax); 4343 __ or_(ecx, eax);
4342 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear); 4344 patch_site.EmitJumpIfNotSmi(ecx, &slow_case, Label::kNear);
4343 __ cmp(edx, eax); 4345 __ cmp(edx, eax);
4344 Split(cc, if_true, if_false, NULL); 4346 Split(cc, if_true, if_false, NULL);
4345 __ bind(&slow_case); 4347 __ bind(&slow_case);
4346 } 4348 }
4347 4349
4348 // Record position and call the compare IC. 4350 // Record position and call the compare IC.
4349 SetSourcePosition(expr->position()); 4351 SetSourcePosition(expr->position());
4350 Handle<Code> ic = CompareIC::GetUninitialized(op); 4352 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
4351 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); 4353 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId());
4352 patch_site.EmitPatchInfo(); 4354 patch_site.EmitPatchInfo();
4353 4355
4354 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 4356 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
4355 __ test(eax, eax); 4357 __ test(eax, eax);
4356 Split(cc, if_true, if_false, fall_through); 4358 Split(cc, if_true, if_false, fall_through);
4357 } 4359 }
4358 } 4360 }
4359 4361
4360 // Convert the result of the comparison into one expected for this 4362 // Convert the result of the comparison into one expected for this
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
4537 *stack_depth = 0; 4539 *stack_depth = 0;
4538 *context_length = 0; 4540 *context_length = 0;
4539 return previous_; 4541 return previous_;
4540 } 4542 }
4541 4543
4542 #undef __ 4544 #undef __
4543 4545
4544 } } // namespace v8::internal 4546 } } // namespace v8::internal
4545 4547
4546 #endif // V8_TARGET_ARCH_IA32 4548 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698