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 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2773 __ lbu(a2, FieldMemOperand(a1, Map::kBitField2Offset)); | 2773 __ lbu(a2, FieldMemOperand(a1, Map::kBitField2Offset)); |
2774 __ Or(a2, a2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 2774 __ Or(a2, a2, Operand(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
2775 __ sb(a2, FieldMemOperand(a1, Map::kBitField2Offset)); | 2775 __ sb(a2, FieldMemOperand(a1, Map::kBitField2Offset)); |
2776 __ jmp(if_true); | 2776 __ jmp(if_true); |
2777 | 2777 |
2778 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 2778 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
2779 context()->Plug(if_true, if_false); | 2779 context()->Plug(if_true, if_false); |
2780 } | 2780 } |
2781 | 2781 |
2782 | 2782 |
2783 void FullCodeGenerator::EmitIsSymbol(CallRuntime* expr) { | |
2784 ZoneList<Expression*>* args = expr->arguments(); | |
2785 ASSERT(args->length() == 1); | |
2786 | |
2787 VisitForAccumulatorValue(args->at(0)); | |
2788 | |
2789 Label materialize_true, materialize_false; | |
2790 Label* if_true = NULL; | |
2791 Label* if_false = NULL; | |
2792 Label* fall_through = NULL; | |
2793 context()->PrepareTest(&materialize_true, &materialize_false, | |
2794 &if_true, &if_false, &fall_through); | |
2795 | |
2796 __ JumpIfSmi(v0, if_false); | |
2797 __ GetObjectType(v0, a1, a2); | |
2798 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
2799 Split(eq, a2, Operand(SYMBOL_TYPE), if_true, if_false, fall_through); | |
2800 | |
2801 context()->Plug(if_true, if_false); | |
2802 } | |
2803 | |
2804 | |
2805 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 2783 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
2806 ZoneList<Expression*>* args = expr->arguments(); | 2784 ZoneList<Expression*>* args = expr->arguments(); |
2807 ASSERT(args->length() == 1); | 2785 ASSERT(args->length() == 1); |
2808 | 2786 |
2809 VisitForAccumulatorValue(args->at(0)); | 2787 VisitForAccumulatorValue(args->at(0)); |
2810 | 2788 |
2811 Label materialize_true, materialize_false; | 2789 Label materialize_true, materialize_false; |
2812 Label* if_true = NULL; | 2790 Label* if_true = NULL; |
2813 Label* if_false = NULL; | 2791 Label* if_false = NULL; |
2814 Label* fall_through = NULL; | 2792 Label* fall_through = NULL; |
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4313 Split(eq, v0, Operand(at), if_true, if_false, fall_through); | 4291 Split(eq, v0, Operand(at), if_true, if_false, fall_through); |
4314 } else if (check->Equals(isolate()->heap()->string_string())) { | 4292 } else if (check->Equals(isolate()->heap()->string_string())) { |
4315 __ JumpIfSmi(v0, if_false); | 4293 __ JumpIfSmi(v0, if_false); |
4316 // Check for undetectable objects => false. | 4294 // Check for undetectable objects => false. |
4317 __ GetObjectType(v0, v0, a1); | 4295 __ GetObjectType(v0, v0, a1); |
4318 __ Branch(if_false, ge, a1, Operand(FIRST_NONSTRING_TYPE)); | 4296 __ Branch(if_false, ge, a1, Operand(FIRST_NONSTRING_TYPE)); |
4319 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); | 4297 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); |
4320 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); | 4298 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); |
4321 Split(eq, a1, Operand(zero_reg), | 4299 Split(eq, a1, Operand(zero_reg), |
4322 if_true, if_false, fall_through); | 4300 if_true, if_false, fall_through); |
| 4301 } else if (check->Equals(isolate()->heap()->symbol_string())) { |
| 4302 __ JumpIfSmi(v0, if_false); |
| 4303 __ GetObjectType(v0, v0, a1); |
| 4304 Split(eq, a1, Operand(SYMBOL_TYPE), if_true, if_false, fall_through); |
4323 } else if (check->Equals(isolate()->heap()->boolean_string())) { | 4305 } else if (check->Equals(isolate()->heap()->boolean_string())) { |
4324 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 4306 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
4325 __ Branch(if_true, eq, v0, Operand(at)); | 4307 __ Branch(if_true, eq, v0, Operand(at)); |
4326 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 4308 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
4327 Split(eq, v0, Operand(at), if_true, if_false, fall_through); | 4309 Split(eq, v0, Operand(at), if_true, if_false, fall_through); |
4328 } else if (FLAG_harmony_typeof && | 4310 } else if (FLAG_harmony_typeof && |
4329 check->Equals(isolate()->heap()->null_string())) { | 4311 check->Equals(isolate()->heap()->null_string())) { |
4330 __ LoadRoot(at, Heap::kNullValueRootIndex); | 4312 __ LoadRoot(at, Heap::kNullValueRootIndex); |
4331 Split(eq, v0, Operand(at), if_true, if_false, fall_through); | 4313 Split(eq, v0, Operand(at), if_true, if_false, fall_through); |
4332 } else if (check->Equals(isolate()->heap()->undefined_string())) { | 4314 } else if (check->Equals(isolate()->heap()->undefined_string())) { |
(...skipping 11 matching lines...) Expand all Loading... |
4344 __ GetObjectType(v0, v0, a1); | 4326 __ GetObjectType(v0, v0, a1); |
4345 __ Branch(if_true, eq, a1, Operand(JS_FUNCTION_TYPE)); | 4327 __ Branch(if_true, eq, a1, Operand(JS_FUNCTION_TYPE)); |
4346 Split(eq, a1, Operand(JS_FUNCTION_PROXY_TYPE), | 4328 Split(eq, a1, Operand(JS_FUNCTION_PROXY_TYPE), |
4347 if_true, if_false, fall_through); | 4329 if_true, if_false, fall_through); |
4348 } else if (check->Equals(isolate()->heap()->object_string())) { | 4330 } else if (check->Equals(isolate()->heap()->object_string())) { |
4349 __ JumpIfSmi(v0, if_false); | 4331 __ JumpIfSmi(v0, if_false); |
4350 if (!FLAG_harmony_typeof) { | 4332 if (!FLAG_harmony_typeof) { |
4351 __ LoadRoot(at, Heap::kNullValueRootIndex); | 4333 __ LoadRoot(at, Heap::kNullValueRootIndex); |
4352 __ Branch(if_true, eq, v0, Operand(at)); | 4334 __ Branch(if_true, eq, v0, Operand(at)); |
4353 } | 4335 } |
4354 if (FLAG_harmony_symbols) { | |
4355 __ GetObjectType(v0, v0, a1); | |
4356 __ Branch(if_true, eq, a1, Operand(SYMBOL_TYPE)); | |
4357 } | |
4358 // Check for JS objects => true. | 4336 // Check for JS objects => true. |
4359 __ GetObjectType(v0, v0, a1); | 4337 __ GetObjectType(v0, v0, a1); |
4360 __ Branch(if_false, lt, a1, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 4338 __ Branch(if_false, lt, a1, Operand(FIRST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
4361 __ lbu(a1, FieldMemOperand(v0, Map::kInstanceTypeOffset)); | 4339 __ lbu(a1, FieldMemOperand(v0, Map::kInstanceTypeOffset)); |
4362 __ Branch(if_false, gt, a1, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); | 4340 __ Branch(if_false, gt, a1, Operand(LAST_NONCALLABLE_SPEC_OBJECT_TYPE)); |
4363 // Check for undetectable objects => false. | 4341 // Check for undetectable objects => false. |
4364 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); | 4342 __ lbu(a1, FieldMemOperand(v0, Map::kBitFieldOffset)); |
4365 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); | 4343 __ And(a1, a1, Operand(1 << Map::kIsUndetectable)); |
4366 Split(eq, a1, Operand(zero_reg), if_true, if_false, fall_through); | 4344 Split(eq, a1, Operand(zero_reg), if_true, if_false, fall_through); |
4367 } else { | 4345 } else { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4624 *context_length = 0; | 4602 *context_length = 0; |
4625 return previous_; | 4603 return previous_; |
4626 } | 4604 } |
4627 | 4605 |
4628 | 4606 |
4629 #undef __ | 4607 #undef __ |
4630 | 4608 |
4631 } } // namespace v8::internal | 4609 } } // namespace v8::internal |
4632 | 4610 |
4633 #endif // V8_TARGET_ARCH_MIPS | 4611 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |