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 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 __ j(below, if_false); | 2542 __ j(below, if_false); |
2543 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 2543 __ cmp(ecx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
2544 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 2544 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
2545 Split(below_equal, if_true, if_false, fall_through); | 2545 Split(below_equal, if_true, if_false, fall_through); |
2546 | 2546 |
2547 context()->Plug(if_true, if_false); | 2547 context()->Plug(if_true, if_false); |
2548 } | 2548 } |
2549 | 2549 |
2550 | 2550 |
2551 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { | 2551 void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { |
| 2552 // TODO(rossberg): incorporate symbols. |
2552 ZoneList<Expression*>* args = expr->arguments(); | 2553 ZoneList<Expression*>* args = expr->arguments(); |
2553 ASSERT(args->length() == 1); | 2554 ASSERT(args->length() == 1); |
2554 | 2555 |
2555 VisitForAccumulatorValue(args->at(0)); | 2556 VisitForAccumulatorValue(args->at(0)); |
2556 | 2557 |
2557 Label materialize_true, materialize_false; | 2558 Label materialize_true, materialize_false; |
2558 Label* if_true = NULL; | 2559 Label* if_true = NULL; |
2559 Label* if_false = NULL; | 2560 Label* if_false = NULL; |
2560 Label* fall_through = NULL; | 2561 Label* fall_through = NULL; |
2561 context()->PrepareTest(&materialize_true, &materialize_false, | 2562 context()->PrepareTest(&materialize_true, &materialize_false, |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2677 // default valueOf and set true result. | 2678 // default valueOf and set true result. |
2678 __ or_(FieldOperand(ebx, Map::kBitField2Offset), | 2679 __ or_(FieldOperand(ebx, Map::kBitField2Offset), |
2679 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); | 2680 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); |
2680 __ jmp(if_true); | 2681 __ jmp(if_true); |
2681 | 2682 |
2682 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | 2683 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
2683 context()->Plug(if_true, if_false); | 2684 context()->Plug(if_true, if_false); |
2684 } | 2685 } |
2685 | 2686 |
2686 | 2687 |
| 2688 void FullCodeGenerator::EmitIsSymbol(CallRuntime* expr) { |
| 2689 ZoneList<Expression*>* args = expr->arguments(); |
| 2690 ASSERT(args->length() == 1); |
| 2691 |
| 2692 VisitForAccumulatorValue(args->at(0)); |
| 2693 |
| 2694 Label materialize_true, materialize_false; |
| 2695 Label* if_true = NULL; |
| 2696 Label* if_false = NULL; |
| 2697 Label* fall_through = NULL; |
| 2698 context()->PrepareTest(&materialize_true, &materialize_false, |
| 2699 &if_true, &if_false, &fall_through); |
| 2700 |
| 2701 __ JumpIfSmi(eax, if_false); |
| 2702 __ CmpObjectType(eax, SYMBOL_TYPE, ebx); |
| 2703 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); |
| 2704 Split(equal, if_true, if_false, fall_through); |
| 2705 |
| 2706 context()->Plug(if_true, if_false); |
| 2707 } |
| 2708 |
| 2709 |
2687 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { | 2710 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { |
2688 ZoneList<Expression*>* args = expr->arguments(); | 2711 ZoneList<Expression*>* args = expr->arguments(); |
2689 ASSERT(args->length() == 1); | 2712 ASSERT(args->length() == 1); |
2690 | 2713 |
2691 VisitForAccumulatorValue(args->at(0)); | 2714 VisitForAccumulatorValue(args->at(0)); |
2692 | 2715 |
2693 Label materialize_true, materialize_false; | 2716 Label materialize_true, materialize_false; |
2694 Label* if_true = NULL; | 2717 Label* if_true = NULL; |
2695 Label* if_false = NULL; | 2718 Label* if_false = NULL; |
2696 Label* fall_through = NULL; | 2719 Label* fall_through = NULL; |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4256 __ CmpObjectType(eax, JS_FUNCTION_TYPE, edx); | 4279 __ CmpObjectType(eax, JS_FUNCTION_TYPE, edx); |
4257 __ j(equal, if_true); | 4280 __ j(equal, if_true); |
4258 __ CmpInstanceType(edx, JS_FUNCTION_PROXY_TYPE); | 4281 __ CmpInstanceType(edx, JS_FUNCTION_PROXY_TYPE); |
4259 Split(equal, if_true, if_false, fall_through); | 4282 Split(equal, if_true, if_false, fall_through); |
4260 } else if (check->Equals(isolate()->heap()->object_string())) { | 4283 } else if (check->Equals(isolate()->heap()->object_string())) { |
4261 __ JumpIfSmi(eax, if_false); | 4284 __ JumpIfSmi(eax, if_false); |
4262 if (!FLAG_harmony_typeof) { | 4285 if (!FLAG_harmony_typeof) { |
4263 __ cmp(eax, isolate()->factory()->null_value()); | 4286 __ cmp(eax, isolate()->factory()->null_value()); |
4264 __ j(equal, if_true); | 4287 __ j(equal, if_true); |
4265 } | 4288 } |
| 4289 if (FLAG_harmony_symbols) { |
| 4290 __ CmpObjectType(eax, SYMBOL_TYPE, edx); |
| 4291 __ j(equal, if_true); |
| 4292 } |
4266 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); | 4293 __ CmpObjectType(eax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, edx); |
4267 __ j(below, if_false); | 4294 __ j(below, if_false); |
4268 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 4295 __ CmpInstanceType(edx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
4269 __ j(above, if_false); | 4296 __ j(above, if_false); |
4270 // Check for undetectable objects => false. | 4297 // Check for undetectable objects => false. |
4271 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), | 4298 __ test_b(FieldOperand(edx, Map::kBitFieldOffset), |
4272 1 << Map::kIsUndetectable); | 4299 1 << Map::kIsUndetectable); |
4273 Split(zero, if_true, if_false, fall_through); | 4300 Split(zero, if_true, if_false, fall_through); |
4274 } else { | 4301 } else { |
4275 if (if_false != fall_through) __ jmp(if_false); | 4302 if (if_false != fall_through) __ jmp(if_false); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4526 *stack_depth = 0; | 4553 *stack_depth = 0; |
4527 *context_length = 0; | 4554 *context_length = 0; |
4528 return previous_; | 4555 return previous_; |
4529 } | 4556 } |
4530 | 4557 |
4531 #undef __ | 4558 #undef __ |
4532 | 4559 |
4533 } } // namespace v8::internal | 4560 } } // namespace v8::internal |
4534 | 4561 |
4535 #endif // V8_TARGET_ARCH_IA32 | 4562 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |