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

Side by Side Diff: src/x64/full-codegen-x64.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/x64/code-stubs-x64.cc ('k') | src/x64/lithium-codegen-x64.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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 1000
1001 __ cmpq(rdx, rax); 1001 __ cmpq(rdx, rax);
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 __ bind(&slow_case); 1005 __ bind(&slow_case);
1006 } 1006 }
1007 1007
1008 // Record position before stub call for type feedback. 1008 // Record position before stub call for type feedback.
1009 SetSourcePosition(clause->position()); 1009 SetSourcePosition(clause->position());
1010 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); 1010 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), Token::EQ_STRICT);
1011 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); 1011 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId());
1012 patch_site.EmitPatchInfo(); 1012 patch_site.EmitPatchInfo();
1013 1013
1014 __ testq(rax, rax); 1014 __ testq(rax, rax);
1015 __ j(not_equal, &next_test); 1015 __ j(not_equal, &next_test);
1016 __ Drop(1); // Switch value is no longer needed. 1016 __ Drop(1); // Switch value is no longer needed.
1017 __ jmp(clause->body_target()); 1017 __ jmp(clause->body_target());
1018 } 1018 }
1019 1019
1020 // Discard the test value and jump to the default if present, otherwise to 1020 // Discard the test value and jump to the default if present, otherwise to
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1919 Label done, stub_call, smi_case; 1919 Label done, stub_call, smi_case;
1920 __ pop(rdx); 1920 __ pop(rdx);
1921 __ movq(rcx, rax); 1921 __ movq(rcx, rax);
1922 __ or_(rax, rdx); 1922 __ or_(rax, rdx);
1923 JumpPatchSite patch_site(masm_); 1923 JumpPatchSite patch_site(masm_);
1924 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear); 1924 patch_site.EmitJumpIfSmi(rax, &smi_case, Label::kNear);
1925 1925
1926 __ bind(&stub_call); 1926 __ bind(&stub_call);
1927 __ movq(rax, rcx); 1927 __ movq(rax, rcx);
1928 BinaryOpStub stub(op, mode); 1928 BinaryOpStub stub(op, mode);
1929 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, 1929 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
1930 expr->BinaryOperationFeedbackId()); 1930 expr->BinaryOperationFeedbackId());
1931 patch_site.EmitPatchInfo(); 1931 patch_site.EmitPatchInfo();
1932 __ jmp(&done, Label::kNear); 1932 __ jmp(&done, Label::kNear);
1933 1933
1934 __ bind(&smi_case); 1934 __ bind(&smi_case);
1935 switch (op) { 1935 switch (op) {
1936 case Token::SAR: 1936 case Token::SAR:
1937 __ SmiShiftArithmeticRight(rax, rdx, rcx); 1937 __ SmiShiftArithmeticRight(rax, rdx, rcx);
1938 break; 1938 break;
1939 case Token::SHL: 1939 case Token::SHL:
(...skipping 29 matching lines...) Expand all
1969 context()->Plug(rax); 1969 context()->Plug(rax);
1970 } 1970 }
1971 1971
1972 1972
1973 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, 1973 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr,
1974 Token::Value op, 1974 Token::Value op,
1975 OverwriteMode mode) { 1975 OverwriteMode mode) {
1976 __ pop(rdx); 1976 __ pop(rdx);
1977 BinaryOpStub stub(op, mode); 1977 BinaryOpStub stub(op, mode);
1978 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. 1978 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code.
1979 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, 1979 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
1980 expr->BinaryOperationFeedbackId()); 1980 expr->BinaryOperationFeedbackId());
1981 patch_site.EmitPatchInfo(); 1981 patch_site.EmitPatchInfo();
1982 context()->Plug(rax); 1982 context()->Plug(rax);
1983 } 1983 }
1984 1984
1985 1985
1986 void FullCodeGenerator::EmitAssignment(Expression* expr) { 1986 void FullCodeGenerator::EmitAssignment(Expression* expr) {
1987 // Invalid left-hand sides are rewritten by the parser to have a 'throw 1987 // Invalid left-hand sides are rewritten by the parser to have a 'throw
1988 // ReferenceError' on the left-hand side. 1988 // ReferenceError' on the left-hand side.
1989 if (!expr->IsValidLeftHandSide()) { 1989 if (!expr->IsValidLeftHandSide()) {
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 2450
2451 // Record call targets in unoptimized code, but not in the snapshot. 2451 // Record call targets in unoptimized code, but not in the snapshot.
2452 Handle<Object> uninitialized = 2452 Handle<Object> uninitialized =
2453 TypeFeedbackCells::UninitializedSentinel(isolate()); 2453 TypeFeedbackCells::UninitializedSentinel(isolate());
2454 Handle<JSGlobalPropertyCell> cell = 2454 Handle<JSGlobalPropertyCell> cell =
2455 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); 2455 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized);
2456 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); 2456 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell);
2457 __ Move(rbx, cell); 2457 __ Move(rbx, cell);
2458 2458
2459 CallConstructStub stub(RECORD_CALL_TARGET); 2459 CallConstructStub stub(RECORD_CALL_TARGET);
2460 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 2460 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL);
2461 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2461 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2462 context()->Plug(rax); 2462 context()->Plug(rax);
2463 } 2463 }
2464 2464
2465 2465
2466 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2466 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
2467 ZoneList<Expression*>* args = expr->arguments(); 2467 ZoneList<Expression*>* args = expr->arguments();
2468 ASSERT(args->length() == 1); 2468 ASSERT(args->length() == 1);
2469 2469
2470 VisitForAccumulatorValue(args->at(0)); 2470 VisitForAccumulatorValue(args->at(0));
(...skipping 1512 matching lines...) Expand 10 before | Expand all | Expand 10 after
3983 // TODO(svenpanne): Allowing format strings in Comment would be nice here... 3983 // TODO(svenpanne): Allowing format strings in Comment would be nice here...
3984 Comment cmt(masm_, comment); 3984 Comment cmt(masm_, comment);
3985 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); 3985 bool can_overwrite = expr->expression()->ResultOverwriteAllowed();
3986 UnaryOverwriteMode overwrite = 3986 UnaryOverwriteMode overwrite =
3987 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; 3987 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE;
3988 UnaryOpStub stub(expr->op(), overwrite); 3988 UnaryOpStub stub(expr->op(), overwrite);
3989 // UnaryOpStub expects the argument to be in the 3989 // UnaryOpStub expects the argument to be in the
3990 // accumulator register rax. 3990 // accumulator register rax.
3991 VisitForAccumulatorValue(expr->expression()); 3991 VisitForAccumulatorValue(expr->expression());
3992 SetSourcePosition(expr->position()); 3992 SetSourcePosition(expr->position());
3993 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, 3993 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET,
3994 expr->UnaryOperationFeedbackId()); 3994 expr->UnaryOperationFeedbackId());
3995 context()->Plug(rax); 3995 context()->Plug(rax);
3996 } 3996 }
3997 3997
3998 3998
3999 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { 3999 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
4000 Comment cmnt(masm_, "[ CountOperation"); 4000 Comment cmnt(masm_, "[ CountOperation");
4001 SetSourcePosition(expr->position()); 4001 SetSourcePosition(expr->position());
4002 4002
4003 // Invalid left-hand-sides are rewritten to have a 'throw 4003 // Invalid left-hand-sides are rewritten to have a 'throw
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 } 4101 }
4102 } 4102 }
4103 4103
4104 // Record position before stub call. 4104 // Record position before stub call.
4105 SetSourcePosition(expr->position()); 4105 SetSourcePosition(expr->position());
4106 4106
4107 // Call stub for +1/-1. 4107 // Call stub for +1/-1.
4108 __ movq(rdx, rax); 4108 __ movq(rdx, rax);
4109 __ Move(rax, Smi::FromInt(1)); 4109 __ Move(rax, Smi::FromInt(1));
4110 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE); 4110 BinaryOpStub stub(expr->binary_op(), NO_OVERWRITE);
4111 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountBinOpFeedbackId()); 4111 CallIC(stub.GetCode(isolate()),
4112 RelocInfo::CODE_TARGET,
4113 expr->CountBinOpFeedbackId());
4112 patch_site.EmitPatchInfo(); 4114 patch_site.EmitPatchInfo();
4113 __ bind(&done); 4115 __ bind(&done);
4114 4116
4115 // Store the value returned in rax. 4117 // Store the value returned in rax.
4116 switch (assign_type) { 4118 switch (assign_type) {
4117 case VARIABLE: 4119 case VARIABLE:
4118 if (expr->is_postfix()) { 4120 if (expr->is_postfix()) {
4119 // Perform the assignment as if via '='. 4121 // Perform the assignment as if via '='.
4120 { EffectContext context(this); 4122 { EffectContext context(this);
4121 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), 4123 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(),
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
4336 __ movq(rcx, rdx); 4338 __ movq(rcx, rdx);
4337 __ or_(rcx, rax); 4339 __ or_(rcx, rax);
4338 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear); 4340 patch_site.EmitJumpIfNotSmi(rcx, &slow_case, Label::kNear);
4339 __ cmpq(rdx, rax); 4341 __ cmpq(rdx, rax);
4340 Split(cc, if_true, if_false, NULL); 4342 Split(cc, if_true, if_false, NULL);
4341 __ bind(&slow_case); 4343 __ bind(&slow_case);
4342 } 4344 }
4343 4345
4344 // Record position and call the compare IC. 4346 // Record position and call the compare IC.
4345 SetSourcePosition(expr->position()); 4347 SetSourcePosition(expr->position());
4346 Handle<Code> ic = CompareIC::GetUninitialized(op); 4348 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
4347 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); 4349 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId());
4348 patch_site.EmitPatchInfo(); 4350 patch_site.EmitPatchInfo();
4349 4351
4350 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 4352 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
4351 __ testq(rax, rax); 4353 __ testq(rax, rax);
4352 Split(cc, if_true, if_false, fall_through); 4354 Split(cc, if_true, if_false, fall_through);
4353 } 4355 }
4354 } 4356 }
4355 4357
4356 // Convert the result of the comparison into one expected for this 4358 // Convert the result of the comparison into one expected for this
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
4537 *context_length = 0; 4539 *context_length = 0;
4538 return previous_; 4540 return previous_;
4539 } 4541 }
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_X64 4548 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698