Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 CountOperation* ExpressionStatement::StatementAsCountOperation() { | 70 CountOperation* ExpressionStatement::StatementAsCountOperation() { |
| 71 return expression()->AsCountOperation(); | 71 return expression()->AsCountOperation(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 VariableProxy::VariableProxy(Variable* var) | 75 VariableProxy::VariableProxy(Variable* var) |
| 76 : name_(var->name()), | 76 : name_(var->name()), |
| 77 var_(NULL), // Will be set by the call to BindTo. | 77 var_(NULL), // Will be set by the call to BindTo. |
| 78 is_this_(var->is_this()), | 78 is_this_(var->is_this()), |
| 79 inside_with_(false), | 79 inside_with_(false), |
| 80 is_trivial_(false) { | 80 is_trivial_(false), |
| 81 position_(RelocInfo::kNoPosition) { | |
| 81 BindTo(var); | 82 BindTo(var); |
| 82 } | 83 } |
| 83 | 84 |
| 84 | 85 |
| 85 VariableProxy::VariableProxy(Handle<String> name, | 86 VariableProxy::VariableProxy(Handle<String> name, |
| 86 bool is_this, | 87 bool is_this, |
| 87 bool inside_with) | 88 bool inside_with, |
| 89 int position) | |
| 88 : name_(name), | 90 : name_(name), |
| 89 var_(NULL), | 91 var_(NULL), |
| 90 is_this_(is_this), | 92 is_this_(is_this), |
| 91 inside_with_(inside_with), | 93 inside_with_(inside_with), |
| 92 is_trivial_(false) { | 94 is_trivial_(false), |
| 95 position_(position) { | |
| 93 // names must be canonicalized for fast equality checks | 96 // names must be canonicalized for fast equality checks |
|
fschneider
2011/04/01 11:38:57
-->Names must be canonicalized for fast equality c
Søren Thygesen Gjesse
2011/04/01 11:47:32
Done.
| |
| 94 ASSERT(name->IsSymbol()); | 97 ASSERT(name->IsSymbol()); |
| 95 } | 98 } |
| 96 | 99 |
| 97 | 100 |
| 98 VariableProxy::VariableProxy(bool is_this) | 101 VariableProxy::VariableProxy(bool is_this) |
| 99 : var_(NULL), | 102 : var_(NULL), |
| 100 is_this_(is_this), | 103 is_this_(is_this), |
| 101 inside_with_(false), | 104 inside_with_(false), |
| 102 is_trivial_(false) { | 105 is_trivial_(false) { |
| 103 } | 106 } |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 615 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); | 618 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); |
| 616 return CanCallWithoutIC(target_, arguments()->length()); | 619 return CanCallWithoutIC(target_, arguments()->length()); |
| 617 } else { | 620 } else { |
| 618 return false; | 621 return false; |
| 619 } | 622 } |
| 620 } | 623 } |
| 621 } | 624 } |
| 622 | 625 |
| 623 | 626 |
| 624 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, | 627 bool Call::ComputeGlobalTarget(Handle<GlobalObject> global, |
| 625 Handle<String> name) { | 628 LookupResult* lookup) { |
| 626 target_ = Handle<JSFunction>::null(); | 629 target_ = Handle<JSFunction>::null(); |
| 627 cell_ = Handle<JSGlobalPropertyCell>::null(); | 630 cell_ = Handle<JSGlobalPropertyCell>::null(); |
| 628 LookupResult lookup; | 631 ASSERT(lookup->IsProperty() && |
| 629 global->Lookup(*name, &lookup); | 632 lookup->type() == NORMAL && |
| 630 if (lookup.IsProperty() && | 633 lookup->holder() == *global); |
| 631 lookup.type() == NORMAL && | 634 cell_ = Handle<JSGlobalPropertyCell>(global->GetPropertyCell(lookup)); |
| 632 lookup.holder() == *global) { | 635 if (cell_->value()->IsJSFunction()) { |
| 633 cell_ = Handle<JSGlobalPropertyCell>(global->GetPropertyCell(&lookup)); | 636 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); |
| 634 if (cell_->value()->IsJSFunction()) { | 637 // If the function is in new space we assume it's more likely to |
| 635 Handle<JSFunction> candidate(JSFunction::cast(cell_->value())); | 638 // change and thus prefer the general IC code. |
| 636 // If the function is in new space we assume it's more likely to | 639 if (!HEAP->InNewSpace(*candidate) && |
| 637 // change and thus prefer the general IC code. | 640 CanCallWithoutIC(candidate, arguments()->length())) { |
| 638 if (!HEAP->InNewSpace(*candidate) && | 641 target_ = candidate; |
| 639 CanCallWithoutIC(candidate, arguments()->length())) { | 642 return true; |
| 640 target_ = candidate; | |
| 641 return true; | |
| 642 } | |
| 643 } | 643 } |
| 644 } | 644 } |
| 645 return false; | 645 return false; |
| 646 } | 646 } |
| 647 | 647 |
| 648 | 648 |
| 649 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle) { | 649 void Call::RecordTypeFeedback(TypeFeedbackOracle* oracle) { |
| 650 Property* property = expression()->AsProperty(); | 650 Property* property = expression()->AsProperty(); |
| 651 ASSERT(property != NULL); | 651 ASSERT(property != NULL); |
| 652 // Specialize for the receiver types seen at runtime. | 652 // Specialize for the receiver types seen at runtime. |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 ZoneList<Statement*>* statements, | 1069 ZoneList<Statement*>* statements, |
| 1070 int pos) | 1070 int pos) |
| 1071 : label_(label), | 1071 : label_(label), |
| 1072 statements_(statements), | 1072 statements_(statements), |
| 1073 position_(pos), | 1073 position_(pos), |
| 1074 compare_type_(NONE), | 1074 compare_type_(NONE), |
| 1075 entry_id_(AstNode::GetNextId()) { | 1075 entry_id_(AstNode::GetNextId()) { |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 } } // namespace v8::internal | 1078 } } // namespace v8::internal |
| OLD | NEW |