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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 return LOOKUP_SLOT_CALL; | 583 return LOOKUP_SLOT_CALL; |
584 } | 584 } |
585 } | 585 } |
586 | 586 |
587 Property* property = expression()->AsProperty(); | 587 Property* property = expression()->AsProperty(); |
588 return property != NULL ? PROPERTY_CALL : OTHER_CALL; | 588 return property != NULL ? PROPERTY_CALL : OTHER_CALL; |
589 } | 589 } |
590 | 590 |
591 | 591 |
592 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, | 592 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, |
593 LookupResult* lookup) { | 593 LookupIterator* it) { |
594 target_ = Handle<JSFunction>::null(); | 594 target_ = Handle<JSFunction>::null(); |
595 cell_ = Handle<Cell>::null(); | 595 cell_ = Handle<Cell>::null(); |
596 DCHECK(lookup->IsFound() && | 596 DCHECK(it->IsFound() && it->GetHolder<JSObject>().is_identical_to(global)); |
597 lookup->type() == NORMAL && | 597 cell_ = it->GetPropertyCell(); |
598 lookup->holder() == *global); | |
599 cell_ = Handle<Cell>(global->GetPropertyCell(lookup)); | |
600 if (cell_->value()->IsJSFunction()) { | 598 if (cell_->value()->IsJSFunction()) { |
601 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); | 599 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); |
602 // If the function is in new space we assume it's more likely to | 600 // If the function is in new space we assume it's more likely to |
603 // change and thus prefer the general IC code. | 601 // change and thus prefer the general IC code. |
604 if (!lookup->isolate()->heap()->InNewSpace(*candidate)) { | 602 if (!it->isolate()->heap()->InNewSpace(*candidate)) { |
605 target_ = candidate; | 603 target_ = candidate; |
606 return true; | 604 return true; |
607 } | 605 } |
608 } | 606 } |
609 return false; | 607 return false; |
610 } | 608 } |
611 | 609 |
612 | 610 |
613 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 611 void CallNew::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
614 int allocation_site_feedback_slot = FLAG_pretenuring_call_new | 612 int allocation_site_feedback_slot = FLAG_pretenuring_call_new |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); | 1135 SNPrintF(buffer, "%d", Smi::cast(*value())->value()); |
1138 str = arr; | 1136 str = arr; |
1139 } else { | 1137 } else { |
1140 str = DoubleToCString(value()->Number(), buffer); | 1138 str = DoubleToCString(value()->Number(), buffer); |
1141 } | 1139 } |
1142 return isolate_->factory()->NewStringFromAsciiChecked(str); | 1140 return isolate_->factory()->NewStringFromAsciiChecked(str); |
1143 } | 1141 } |
1144 | 1142 |
1145 | 1143 |
1146 } } // namespace v8::internal | 1144 } } // namespace v8::internal |
OLD | NEW |