OLD | NEW |
1 // Copyright 2011 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 |
(...skipping 4091 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4102 Split(cc, v0, Operand(zero_reg), if_true, if_false, fall_through); | 4102 Split(cc, v0, Operand(zero_reg), if_true, if_false, fall_through); |
4103 } | 4103 } |
4104 } | 4104 } |
4105 | 4105 |
4106 // Convert the result of the comparison into one expected for this | 4106 // Convert the result of the comparison into one expected for this |
4107 // expression's context. | 4107 // expression's context. |
4108 context()->Plug(if_true, if_false); | 4108 context()->Plug(if_true, if_false); |
4109 } | 4109 } |
4110 | 4110 |
4111 | 4111 |
4112 void FullCodeGenerator::VisitCompareToNull(CompareToNull* expr) { | 4112 void FullCodeGenerator::EmitLiteralCompareNull(Expression* expr, |
4113 Comment cmnt(masm_, "[ CompareToNull"); | 4113 bool is_strict, |
4114 Label materialize_true, materialize_false; | 4114 Label* if_true, |
4115 Label* if_true = NULL; | 4115 Label* if_false, |
4116 Label* if_false = NULL; | 4116 Label* fall_through) { |
4117 Label* fall_through = NULL; | 4117 VisitForAccumulatorValue(expr); |
4118 context()->PrepareTest(&materialize_true, &materialize_false, | |
4119 &if_true, &if_false, &fall_through); | |
4120 | |
4121 VisitForAccumulatorValue(expr->expression()); | |
4122 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); | 4118 PrepareForBailoutBeforeSplit(TOS_REG, true, if_true, if_false); |
4123 __ mov(a0, result_register()); | 4119 __ mov(a0, result_register()); |
4124 __ LoadRoot(a1, Heap::kNullValueRootIndex); | 4120 __ LoadRoot(a1, Heap::kNullValueRootIndex); |
4125 if (expr->is_strict()) { | 4121 if (is_strict) { |
4126 Split(eq, a0, Operand(a1), if_true, if_false, fall_through); | 4122 Split(eq, a0, Operand(a1), if_true, if_false, fall_through); |
4127 } else { | 4123 } else { |
4128 __ Branch(if_true, eq, a0, Operand(a1)); | 4124 __ Branch(if_true, eq, a0, Operand(a1)); |
4129 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); | 4125 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); |
4130 __ Branch(if_true, eq, a0, Operand(a1)); | 4126 __ Branch(if_true, eq, a0, Operand(a1)); |
4131 __ And(at, a0, Operand(kSmiTagMask)); | 4127 __ And(at, a0, Operand(kSmiTagMask)); |
4132 __ Branch(if_false, eq, at, Operand(zero_reg)); | 4128 __ Branch(if_false, eq, at, Operand(zero_reg)); |
4133 // It can be an undetectable object. | 4129 // It can be an undetectable object. |
4134 __ lw(a1, FieldMemOperand(a0, HeapObject::kMapOffset)); | 4130 __ lw(a1, FieldMemOperand(a0, HeapObject::kMapOffset)); |
4135 __ lbu(a1, FieldMemOperand(a1, Map::kBitFieldOffset)); | 4131 __ lbu(a1, FieldMemOperand(a1, Map::kBitFieldOffset)); |
4136 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); | 4132 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); |
4137 Split(ne, a1, Operand(zero_reg), if_true, if_false, fall_through); | 4133 Split(ne, a1, Operand(zero_reg), if_true, if_false, fall_through); |
4138 } | 4134 } |
4139 context()->Plug(if_true, if_false); | |
4140 } | 4135 } |
4141 | 4136 |
4142 | 4137 |
4143 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { | 4138 void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) { |
4144 __ lw(v0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 4139 __ lw(v0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
4145 context()->Plug(v0); | 4140 context()->Plug(v0); |
4146 } | 4141 } |
4147 | 4142 |
4148 | 4143 |
4149 Register FullCodeGenerator::result_register() { | 4144 Register FullCodeGenerator::result_register() { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4243 *context_length = 0; | 4238 *context_length = 0; |
4244 return previous_; | 4239 return previous_; |
4245 } | 4240 } |
4246 | 4241 |
4247 | 4242 |
4248 #undef __ | 4243 #undef __ |
4249 | 4244 |
4250 } } // namespace v8::internal | 4245 } } // namespace v8::internal |
4251 | 4246 |
4252 #endif // V8_TARGET_ARCH_MIPS | 4247 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |