OLD | NEW |
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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1039 | 1039 |
1040 __ Branch(&next_test, ne, a1, Operand(a0)); | 1040 __ Branch(&next_test, ne, a1, Operand(a0)); |
1041 __ Drop(1); // Switch value is no longer needed. | 1041 __ Drop(1); // Switch value is no longer needed. |
1042 __ Branch(clause->body_target()); | 1042 __ Branch(clause->body_target()); |
1043 | 1043 |
1044 __ bind(&slow_case); | 1044 __ bind(&slow_case); |
1045 } | 1045 } |
1046 | 1046 |
1047 // Record position before stub call for type feedback. | 1047 // Record position before stub call for type feedback. |
1048 SetSourcePosition(clause->position()); | 1048 SetSourcePosition(clause->position()); |
1049 Handle<Code> ic = CompareIC::GetUninitialized(Token::EQ_STRICT); | 1049 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), Token::EQ_STRICT); |
1050 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); | 1050 CallIC(ic, RelocInfo::CODE_TARGET, clause->CompareId()); |
1051 patch_site.EmitPatchInfo(); | 1051 patch_site.EmitPatchInfo(); |
1052 | 1052 |
1053 __ Branch(&next_test, ne, v0, Operand(zero_reg)); | 1053 __ Branch(&next_test, ne, v0, Operand(zero_reg)); |
1054 __ Drop(1); // Switch value is no longer needed. | 1054 __ Drop(1); // Switch value is no longer needed. |
1055 __ Branch(clause->body_target()); | 1055 __ Branch(clause->body_target()); |
1056 } | 1056 } |
1057 | 1057 |
1058 // Discard the test value and jump to the default if present, otherwise to | 1058 // Discard the test value and jump to the default if present, otherwise to |
1059 // the end of the statement. | 1059 // the end of the statement. |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1958 __ mov(a0, result_register()); | 1958 __ mov(a0, result_register()); |
1959 | 1959 |
1960 // Perform combined smi check on both operands. | 1960 // Perform combined smi check on both operands. |
1961 __ Or(scratch1, left, Operand(right)); | 1961 __ Or(scratch1, left, Operand(right)); |
1962 STATIC_ASSERT(kSmiTag == 0); | 1962 STATIC_ASSERT(kSmiTag == 0); |
1963 JumpPatchSite patch_site(masm_); | 1963 JumpPatchSite patch_site(masm_); |
1964 patch_site.EmitJumpIfSmi(scratch1, &smi_case); | 1964 patch_site.EmitJumpIfSmi(scratch1, &smi_case); |
1965 | 1965 |
1966 __ bind(&stub_call); | 1966 __ bind(&stub_call); |
1967 BinaryOpStub stub(op, mode); | 1967 BinaryOpStub stub(op, mode); |
1968 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, | 1968 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
1969 expr->BinaryOperationFeedbackId()); | 1969 expr->BinaryOperationFeedbackId()); |
1970 patch_site.EmitPatchInfo(); | 1970 patch_site.EmitPatchInfo(); |
1971 __ jmp(&done); | 1971 __ jmp(&done); |
1972 | 1972 |
1973 __ bind(&smi_case); | 1973 __ bind(&smi_case); |
1974 // Smi case. This code works the same way as the smi-smi case in the type | 1974 // Smi case. This code works the same way as the smi-smi case in the type |
1975 // recording binary operation stub, see | 1975 // recording binary operation stub, see |
1976 // BinaryOpStub::GenerateSmiSmiOperation for comments. | 1976 // BinaryOpStub::GenerateSmiSmiOperation for comments. |
1977 switch (op) { | 1977 switch (op) { |
1978 case Token::SAR: | 1978 case Token::SAR: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 } | 2042 } |
2043 | 2043 |
2044 | 2044 |
2045 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, | 2045 void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, |
2046 Token::Value op, | 2046 Token::Value op, |
2047 OverwriteMode mode) { | 2047 OverwriteMode mode) { |
2048 __ mov(a0, result_register()); | 2048 __ mov(a0, result_register()); |
2049 __ pop(a1); | 2049 __ pop(a1); |
2050 BinaryOpStub stub(op, mode); | 2050 BinaryOpStub stub(op, mode); |
2051 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. | 2051 JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. |
2052 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, | 2052 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
2053 expr->BinaryOperationFeedbackId()); | 2053 expr->BinaryOperationFeedbackId()); |
2054 patch_site.EmitPatchInfo(); | 2054 patch_site.EmitPatchInfo(); |
2055 context()->Plug(v0); | 2055 context()->Plug(v0); |
2056 } | 2056 } |
2057 | 2057 |
2058 | 2058 |
2059 void FullCodeGenerator::EmitAssignment(Expression* expr) { | 2059 void FullCodeGenerator::EmitAssignment(Expression* expr) { |
2060 // Invalid left-hand sides are rewritten by the parser to have a 'throw | 2060 // Invalid left-hand sides are rewritten by the parser to have a 'throw |
2061 // ReferenceError' on the left-hand side. | 2061 // ReferenceError' on the left-hand side. |
2062 if (!expr->IsValidLeftHandSide()) { | 2062 if (!expr->IsValidLeftHandSide()) { |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 | 2550 |
2551 // Record call targets in unoptimized code. | 2551 // Record call targets in unoptimized code. |
2552 Handle<Object> uninitialized = | 2552 Handle<Object> uninitialized = |
2553 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2553 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2554 Handle<JSGlobalPropertyCell> cell = | 2554 Handle<JSGlobalPropertyCell> cell = |
2555 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | 2555 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
2556 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); | 2556 RecordTypeFeedbackCell(expr->CallNewFeedbackId(), cell); |
2557 __ li(a2, Operand(cell)); | 2557 __ li(a2, Operand(cell)); |
2558 | 2558 |
2559 CallConstructStub stub(RECORD_CALL_TARGET); | 2559 CallConstructStub stub(RECORD_CALL_TARGET); |
2560 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 2560 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
2561 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2561 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2562 context()->Plug(v0); | 2562 context()->Plug(v0); |
2563 } | 2563 } |
2564 | 2564 |
2565 | 2565 |
2566 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2566 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2567 ZoneList<Expression*>* args = expr->arguments(); | 2567 ZoneList<Expression*>* args = expr->arguments(); |
2568 ASSERT(args->length() == 1); | 2568 ASSERT(args->length() == 1); |
2569 | 2569 |
2570 VisitForAccumulatorValue(args->at(0)); | 2570 VisitForAccumulatorValue(args->at(0)); |
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4036 // TODO(svenpanne): Allowing format strings in Comment would be nice here... | 4036 // TODO(svenpanne): Allowing format strings in Comment would be nice here... |
4037 Comment cmt(masm_, comment); | 4037 Comment cmt(masm_, comment); |
4038 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); | 4038 bool can_overwrite = expr->expression()->ResultOverwriteAllowed(); |
4039 UnaryOverwriteMode overwrite = | 4039 UnaryOverwriteMode overwrite = |
4040 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; | 4040 can_overwrite ? UNARY_OVERWRITE : UNARY_NO_OVERWRITE; |
4041 UnaryOpStub stub(expr->op(), overwrite); | 4041 UnaryOpStub stub(expr->op(), overwrite); |
4042 // GenericUnaryOpStub expects the argument to be in a0. | 4042 // GenericUnaryOpStub expects the argument to be in a0. |
4043 VisitForAccumulatorValue(expr->expression()); | 4043 VisitForAccumulatorValue(expr->expression()); |
4044 SetSourcePosition(expr->position()); | 4044 SetSourcePosition(expr->position()); |
4045 __ mov(a0, result_register()); | 4045 __ mov(a0, result_register()); |
4046 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, | 4046 CallIC(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, |
4047 expr->UnaryOperationFeedbackId()); | 4047 expr->UnaryOperationFeedbackId()); |
4048 context()->Plug(v0); | 4048 context()->Plug(v0); |
4049 } | 4049 } |
4050 | 4050 |
4051 | 4051 |
4052 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { | 4052 void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { |
4053 Comment cmnt(masm_, "[ CountOperation"); | 4053 Comment cmnt(masm_, "[ CountOperation"); |
4054 SetSourcePosition(expr->position()); | 4054 SetSourcePosition(expr->position()); |
4055 | 4055 |
4056 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' | 4056 // Invalid left-hand sides are rewritten to have a 'throw ReferenceError' |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4149 patch_site.EmitJumpIfSmi(v0, &done); | 4149 patch_site.EmitJumpIfSmi(v0, &done); |
4150 __ bind(&stub_call); | 4150 __ bind(&stub_call); |
4151 } | 4151 } |
4152 __ mov(a1, a0); | 4152 __ mov(a1, a0); |
4153 __ li(a0, Operand(Smi::FromInt(count_value))); | 4153 __ li(a0, Operand(Smi::FromInt(count_value))); |
4154 | 4154 |
4155 // Record position before stub call. | 4155 // Record position before stub call. |
4156 SetSourcePosition(expr->position()); | 4156 SetSourcePosition(expr->position()); |
4157 | 4157 |
4158 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); | 4158 BinaryOpStub stub(Token::ADD, NO_OVERWRITE); |
4159 CallIC(stub.GetCode(), RelocInfo::CODE_TARGET, expr->CountBinOpFeedbackId()); | 4159 CallIC(stub.GetCode(isolate()), |
| 4160 RelocInfo::CODE_TARGET, |
| 4161 expr->CountBinOpFeedbackId()); |
4160 patch_site.EmitPatchInfo(); | 4162 patch_site.EmitPatchInfo(); |
4161 __ bind(&done); | 4163 __ bind(&done); |
4162 | 4164 |
4163 // Store the value returned in v0. | 4165 // Store the value returned in v0. |
4164 switch (assign_type) { | 4166 switch (assign_type) { |
4165 case VARIABLE: | 4167 case VARIABLE: |
4166 if (expr->is_postfix()) { | 4168 if (expr->is_postfix()) { |
4167 { EffectContext context(this); | 4169 { EffectContext context(this); |
4168 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), | 4170 EmitVariableAssignment(expr->expression()->AsVariableProxy()->var(), |
4169 Token::ASSIGN); | 4171 Token::ASSIGN); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4381 JumpPatchSite patch_site(masm_); | 4383 JumpPatchSite patch_site(masm_); |
4382 if (inline_smi_code) { | 4384 if (inline_smi_code) { |
4383 Label slow_case; | 4385 Label slow_case; |
4384 __ Or(a2, a0, Operand(a1)); | 4386 __ Or(a2, a0, Operand(a1)); |
4385 patch_site.EmitJumpIfNotSmi(a2, &slow_case); | 4387 patch_site.EmitJumpIfNotSmi(a2, &slow_case); |
4386 Split(cc, a1, Operand(a0), if_true, if_false, NULL); | 4388 Split(cc, a1, Operand(a0), if_true, if_false, NULL); |
4387 __ bind(&slow_case); | 4389 __ bind(&slow_case); |
4388 } | 4390 } |
4389 // Record position and call the compare IC. | 4391 // Record position and call the compare IC. |
4390 SetSourcePosition(expr->position()); | 4392 SetSourcePosition(expr->position()); |
4391 Handle<Code> ic = CompareIC::GetUninitialized(op); | 4393 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op); |
4392 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); | 4394 CallIC(ic, RelocInfo::CODE_TARGET, expr->CompareOperationFeedbackId()); |
4393 patch_site.EmitPatchInfo(); | 4395 patch_site.EmitPatchInfo(); |
4394 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 4396 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
4395 Split(cc, v0, Operand(zero_reg), if_true, if_false, fall_through); | 4397 Split(cc, v0, Operand(zero_reg), if_true, if_false, fall_through); |
4396 } | 4398 } |
4397 } | 4399 } |
4398 | 4400 |
4399 // Convert the result of the comparison into one expected for this | 4401 // Convert the result of the comparison into one expected for this |
4400 // expression's context. | 4402 // expression's context. |
4401 context()->Plug(if_true, if_false); | 4403 context()->Plug(if_true, if_false); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4586 *context_length = 0; | 4588 *context_length = 0; |
4587 return previous_; | 4589 return previous_; |
4588 } | 4590 } |
4589 | 4591 |
4590 | 4592 |
4591 #undef __ | 4593 #undef __ |
4592 | 4594 |
4593 } } // namespace v8::internal | 4595 } } // namespace v8::internal |
4594 | 4596 |
4595 #endif // V8_TARGET_ARCH_MIPS | 4597 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |