OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast.h" | 5 #include "src/ast.h" |
6 | 6 |
7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
8 #include "src/builtins.h" | 8 #include "src/builtins.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/contexts.h" | 10 #include "src/contexts.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // Recording of type feedback | 571 // Recording of type feedback |
572 | 572 |
573 // TODO(rossberg): all RecordTypeFeedback functions should disappear | 573 // TODO(rossberg): all RecordTypeFeedback functions should disappear |
574 // once we use the common type field in the AST consistently. | 574 // once we use the common type field in the AST consistently. |
575 | 575 |
576 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { | 576 void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) { |
577 set_to_boolean_types(oracle->ToBooleanTypes(test_id())); | 577 set_to_boolean_types(oracle->ToBooleanTypes(test_id())); |
578 } | 578 } |
579 | 579 |
580 | 580 |
| 581 bool Call::IsUsingCallFeedbackICSlot(Isolate* isolate) const { |
| 582 CallType call_type = GetCallType(isolate); |
| 583 if (IsUsingCallFeedbackSlot(isolate) || call_type == POSSIBLY_EVAL_CALL) { |
| 584 return false; |
| 585 } |
| 586 return true; |
| 587 } |
| 588 |
| 589 |
581 bool Call::IsUsingCallFeedbackSlot(Isolate* isolate) const { | 590 bool Call::IsUsingCallFeedbackSlot(Isolate* isolate) const { |
582 CallType call_type = GetCallType(isolate); | 591 // SuperConstructorCall uses a CallConstructStub, which wants |
583 return (call_type != POSSIBLY_EVAL_CALL); | 592 // a Slot, not an IC slot. |
| 593 return FLAG_experimental_classes && GetCallType(isolate) == SUPER_CALL; |
584 } | 594 } |
585 | 595 |
586 | 596 |
587 FeedbackVectorRequirements Call::ComputeFeedbackRequirements(Isolate* isolate) { | 597 FeedbackVectorRequirements Call::ComputeFeedbackRequirements(Isolate* isolate) { |
588 int ic_slots = IsUsingCallFeedbackSlot(isolate) ? 1 : 0; | 598 int ic_slots = IsUsingCallFeedbackICSlot(isolate) ? 1 : 0; |
589 return FeedbackVectorRequirements(0, ic_slots); | 599 int slots = IsUsingCallFeedbackSlot(isolate) ? 1 : 0; |
| 600 // A Call uses either a slot or an IC slot. |
| 601 DCHECK((ic_slots & slots) == 0); |
| 602 return FeedbackVectorRequirements(slots, ic_slots); |
590 } | 603 } |
591 | 604 |
592 | 605 |
593 Call::CallType Call::GetCallType(Isolate* isolate) const { | 606 Call::CallType Call::GetCallType(Isolate* isolate) const { |
594 VariableProxy* proxy = expression()->AsVariableProxy(); | 607 VariableProxy* proxy = expression()->AsVariableProxy(); |
595 if (proxy != NULL) { | 608 if (proxy != NULL) { |
596 if (proxy->var()->is_possibly_eval(isolate)) { | 609 if (proxy->var()->is_possibly_eval(isolate)) { |
597 return POSSIBLY_EVAL_CALL; | 610 return POSSIBLY_EVAL_CALL; |
598 } else if (proxy->var()->IsUnallocated()) { | 611 } else if (proxy->var()->IsUnallocated()) { |
599 return GLOBAL_CALL; | 612 return GLOBAL_CALL; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 // static | 1042 // static |
1030 bool Literal::Match(void* literal1, void* literal2) { | 1043 bool Literal::Match(void* literal1, void* literal2) { |
1031 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1044 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
1032 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1045 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
1033 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || | 1046 return (x->IsString() && y->IsString() && *x->AsString() == *y->AsString()) || |
1034 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1047 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
1035 } | 1048 } |
1036 | 1049 |
1037 | 1050 |
1038 } } // namespace v8::internal | 1051 } } // namespace v8::internal |
OLD | NEW |