| 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 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2560 __ j(below, if_false); | 2560 __ j(below, if_false); |
| 2561 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 2561 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 2562 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 2562 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 2563 Split(below_equal, if_true, if_false, fall_through); | 2563 Split(below_equal, if_true, if_false, fall_through); |
| 2564 | 2564 |
| 2565 context()->Plug(if_true, if_false); | 2565 context()->Plug(if_true, if_false); |
| 2566 } | 2566 } |
| 2567 | 2567 |
| 2568 | 2568 |
| 2569 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { | 2569 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { |
| 2570 // TODO(rossberg): incorporate symbols. | |
| 2571 ZoneList<Expression*>* args = expr->arguments(); | 2570 ZoneList<Expression*>* args = expr->arguments(); |
| 2572 ASSERT(args->length() == 1); | 2571 ASSERT(args->length() == 1); |
| 2573 | 2572 |
| 2574 VisitForAccumulatorValue(args->at(0)); | 2573 VisitForAccumulatorValue(args->at(0)); |
| 2575 | 2574 |
| 2576 Label materialize_true, materialize_false; | 2575 Label materialize_true, materialize_false; |
| 2577 Label* if_true = NULL; | 2576 Label* if_true = NULL; |
| 2578 Label* if_false = NULL; | 2577 Label* if_false = NULL; |
| 2579 Label* fall_through = NULL; | 2578 Label* fall_through = NULL; |
| 2580 context()->PrepareTest(&materialize_true, &materialize_false, | 2579 context()->PrepareTest(&materialize_true, &materialize_false, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2696 // default valueOf and set true result. | 2695 // default valueOf and set true result. |
| 2697 __ or_(FieldOperand(ebx, Map::kBitField2Offset), | 2696 __ or_(FieldOperand(ebx, Map::kBitField2Offset), |
| 2698 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 2697 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
| 2699 __ jmp(if_true); | 2698 __ jmp(if_true); |
| 2700 | 2699 |
| 2701 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 2700 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 2702 context()->Plug(if_true, if_false); | 2701 context()->Plug(if_true, if_false); |
| 2703 } | 2702 } |
| 2704 | 2703 |
| 2705 | 2704 |
| 2706 void FullCodeGenerator::EmitIsSymbol(CallRuntime* expr) { | |
| 2707 ZoneList<Expression*>* args = expr->arguments(); | |
| 2708 ASSERT(args->length() == 1); | |
| 2709 | |
| 2710 VisitForAccumulatorValue(args->at(0)); | |
| 2711 | |
| 2712 Label materialize_true, materialize_false; | |
| 2713 Label* if_true = NULL; | |
| 2714 Label* if_false = NULL; | |
| 2715 Label* fall_through = NULL; | |
| 2716 context()->PrepareTest(&materialize_true, &materialize_false, | |
| 2717 &if_true, &if_false, &fall_through); | |
| 2718 | |
| 2719 __ JumpIfSmi(eax, if_false); | |
| 2720 __ CmpObjectType(eax, SYMBOL_TYPE, ebx); | |
| 2721 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
| 2722 Split(equal, if_true, if_false, fall_through); | |
| 2723 | |
| 2724 context()->Plug(if_true, if_false); | |
| 2725 } | |
| 2726 | |
| 2727 | |
| 2728 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 2705 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
| 2729 ZoneList<Expression*>* args = expr->arguments(); | 2706 ZoneList<Expression*>* args = expr->arguments(); |
| 2730 ASSERT(args->length() == 1); | 2707 ASSERT(args->length() == 1); |
| 2731 | 2708 |
| 2732 VisitForAccumulatorValue(args->at(0)); | 2709 VisitForAccumulatorValue(args->at(0)); |
| 2733 | 2710 |
| 2734 Label materialize_true, materialize_false; | 2711 Label materialize_true, materialize_false; |
| 2735 Label* if_true = NULL; | 2712 Label* if_true = NULL; |
| 2736 Label* if_false = NULL; | 2713 Label* if_false = NULL; |
| 2737 Label* fall_through = NULL; | 2714 Label* fall_through = NULL; |
| (...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4268 isolate()->factory()->heap_number_map()); | 4245 isolate()->factory()->heap_number_map()); |
| 4269 Split(equal, if_true, if_false, fall_through); | 4246 Split(equal, if_true, if_false, fall_through); |
| 4270 } else if (check->Equals(isolate()->heap()->string_string())) { | 4247 } else if (check->Equals(isolate()->heap()->string_string())) { |
| 4271 __ JumpIfSmi(eax, if_false); | 4248 __ JumpIfSmi(eax, if_false); |
| 4272 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edx); | 4249 __ CmpObjectType(eax, FIRST_NONSTRING_TYPE, edx); |
| 4273 __ j(above_equal, if_false); | 4250 __ j(above_equal, if_false); |
| 4274 // Check for undetectable objects => false. | 4251 // Check for undetectable objects => false. |
| 4275 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), | 4252 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), |
| 4276 1 << Map::kIsUndetectable); | 4253 1 << Map::kIsUndetectable); |
| 4277 Split(zero, if_true, if_false, fall_through); | 4254 Split(zero, if_true, if_false, fall_through); |
| 4255 } else if (check->Equals(isolate()->heap()->symbol_string())) { |
| 4256 __ JumpIfSmi(eax, if_false); |
| 4257 __ CmpObjectType(eax, SYMBOL_TYPE, edx); |
| 4258 Split(equal, if_true, if_false, fall_through); |
| 4278 } else if (check->Equals(isolate()->heap()->boolean_string())) { | 4259 } else if (check->Equals(isolate()->heap()->boolean_string())) { |
| 4279 __ cmp(eax, isolate()->factory()->true_value()); | 4260 __ cmp(eax, isolate()->factory()->true_value()); |
| 4280 __ j(equal, if_true); | 4261 __ j(equal, if_true); |
| 4281 __ cmp(eax, isolate()->factory()->false_value()); | 4262 __ cmp(eax, isolate()->factory()->false_value()); |
| 4282 Split(equal, if_true, if_false, fall_through); | 4263 Split(equal, if_true, if_false, fall_through); |
| 4283 } else if (FLAG_harmony_typeof && | 4264 } else if (FLAG_harmony_typeof && |
| 4284 check->Equals(isolate()->heap()->null_string())) { | 4265 check->Equals(isolate()->heap()->null_string())) { |
| 4285 __ cmp(eax, isolate()->factory()->null_value()); | 4266 __ cmp(eax, isolate()->factory()->null_value()); |
| 4286 Split(equal, if_true, if_false, fall_through); | 4267 Split(equal, if_true, if_false, fall_through); |
| 4287 } else if (check->Equals(isolate()->heap()->undefined_string())) { | 4268 } else if (check->Equals(isolate()->heap()->undefined_string())) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4299 __ CmpObjectType(eax, JS_FUNCTION_TYPE, edx); | 4280 __ CmpObjectType(eax, JS_FUNCTION_TYPE, edx); |
| 4300 __ j(equal, if_true); | 4281 __ j(equal, if_true); |
| 4301 __ CmpInstanceType(edx, JS_FUNCTION_PROXY_TYPE); | 4282 __ CmpInstanceType(edx, JS_FUNCTION_PROXY_TYPE); |
| 4302 Split(equal, if_true, if_false, fall_through); | 4283 Split(equal, if_true, if_false, fall_through); |
| 4303 } else if (check->Equals(isolate()->heap()->object_string())) { | 4284 } else if (check->Equals(isolate()->heap()->object_string())) { |
| 4304 __ JumpIfSmi(eax, if_false); | 4285 __ JumpIfSmi(eax, if_false); |
| 4305 if (!FLAG_harmony_typeof) { | 4286 if (!FLAG_harmony_typeof) { |
| 4306 __ cmp(eax, isolate()->factory()->null_value()); | 4287 __ cmp(eax, isolate()->factory()->null_value()); |
| 4307 __ j(equal, if_true); | 4288 __ j(equal, if_true); |
| 4308 } | 4289 } |
| 4309 if (FLAG_harmony_symbols) { | |
| 4310 __ CmpObjectType(eax, SYMBOL_TYPE, edx); | |
| 4311 __ j(equal, if_true); | |
| 4312 } | |
| 4313 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); | 4290 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); |
| 4314 __ j(below, if_false); | 4291 __ j(below, if_false); |
| 4315 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 4292 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 4316 __ j(above, if_false); | 4293 __ j(above, if_false); |
| 4317 // Check for undetectable objects => false. | 4294 // Check for undetectable objects => false. |
| 4318 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), | 4295 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), |
| 4319 1 << Map::kIsUndetectable); | 4296 1 << Map::kIsUndetectable); |
| 4320 Split(zero, if_true, if_false, fall_through); | 4297 Split(zero, if_true, if_false, fall_through); |
| 4321 } else { | 4298 } else { |
| 4322 if (if_false != fall_through) __ jmp(if_false); | 4299 if (if_false != fall_through) __ jmp(if_false); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4573 *stack_depth = 0; | 4550 *stack_depth = 0; |
| 4574 *context_length = 0; | 4551 *context_length = 0; |
| 4575 return previous_; | 4552 return previous_; |
| 4576 } | 4553 } |
| 4577 | 4554 |
| 4578 #undef __ | 4555 #undef __ |
| 4579 | 4556 |
| 4580 } } // namespace v8::internal | 4557 } } // namespace v8::internal |
| 4581 | 4558 |
| 4582 #endif // V8_TARGET_ARCH_IA32 | 4559 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |