OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 CountOperation* ExpressionStatement::StatementAsCountOperation() { | 59 CountOperation* ExpressionStatement::StatementAsCountOperation() { |
60 return expression()->AsCountOperation(); | 60 return expression()->AsCountOperation(); |
61 } | 61 } |
62 | 62 |
63 | 63 |
64 VariableProxy::VariableProxy(Isolate* isolate, Variable* var) | 64 VariableProxy::VariableProxy(Isolate* isolate, Variable* var) |
65 : Expression(isolate), | 65 : Expression(isolate), |
66 name_(var->name()), | 66 name_(var->name()), |
67 var_(NULL), // Will be set by the call to BindTo. | 67 var_(NULL), // Will be set by the call to BindTo. |
68 is_this_(var->is_this()), | 68 is_this_(var->is_this()), |
69 inside_with_(false), | |
70 is_trivial_(false), | 69 is_trivial_(false), |
71 position_(RelocInfo::kNoPosition) { | 70 position_(RelocInfo::kNoPosition) { |
72 BindTo(var); | 71 BindTo(var); |
73 } | 72 } |
74 | 73 |
75 | 74 |
76 VariableProxy::VariableProxy(Isolate* isolate, | 75 VariableProxy::VariableProxy(Isolate* isolate, |
77 Handle<String> name, | 76 Handle<String> name, |
78 bool is_this, | 77 bool is_this, |
79 bool inside_with, | |
80 int position) | 78 int position) |
81 : Expression(isolate), | 79 : Expression(isolate), |
82 name_(name), | 80 name_(name), |
83 var_(NULL), | 81 var_(NULL), |
84 is_this_(is_this), | 82 is_this_(is_this), |
85 inside_with_(inside_with), | |
86 is_trivial_(false), | 83 is_trivial_(false), |
87 position_(position) { | 84 position_(position) { |
88 // Names must be canonicalized for fast equality checks. | 85 // Names must be canonicalized for fast equality checks. |
89 ASSERT(name->IsSymbol()); | 86 ASSERT(name->IsSymbol()); |
90 } | 87 } |
91 | 88 |
92 | 89 |
93 void VariableProxy::BindTo(Variable* var) { | 90 void VariableProxy::BindTo(Variable* var) { |
94 ASSERT(var_ == NULL); // must be bound only once | 91 ASSERT(var_ == NULL); // must be bound only once |
95 ASSERT(var != NULL); // must bind | 92 ASSERT(var != NULL); // must bind |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 458 } |
462 | 459 |
463 | 460 |
464 bool FunctionLiteral::IsInlineable() const { | 461 bool FunctionLiteral::IsInlineable() const { |
465 // TODO(1322): Allow materialized literals. | 462 // TODO(1322): Allow materialized literals. |
466 return false; | 463 return false; |
467 } | 464 } |
468 | 465 |
469 | 466 |
470 bool ThisFunction::IsInlineable() const { | 467 bool ThisFunction::IsInlineable() const { |
471 return false; | 468 return true; |
472 } | 469 } |
473 | 470 |
474 | 471 |
475 bool SharedFunctionInfoLiteral::IsInlineable() const { | 472 bool SharedFunctionInfoLiteral::IsInlineable() const { |
476 return false; | 473 return false; |
477 } | 474 } |
478 | 475 |
479 | 476 |
480 bool ForStatement::IsInlineable() const { | 477 bool ForStatement::IsInlineable() const { |
481 return (init() == NULL || init()->IsInlineable()) | 478 return (init() == NULL || init()->IsInlineable()) |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { | 713 bool Call::ComputeTarget(Handle<Map> type, Handle<String> name) { |
717 if (check_type_ == RECEIVER_MAP_CHECK) { | 714 if (check_type_ == RECEIVER_MAP_CHECK) { |
718 // For primitive checks the holder is set up to point to the | 715 // For primitive checks the holder is set up to point to the |
719 // corresponding prototype object, i.e. one step of the algorithm | 716 // corresponding prototype object, i.e. one step of the algorithm |
720 // below has been already performed. | 717 // below has been already performed. |
721 // For non-primitive checks we clear it to allow computing targets | 718 // For non-primitive checks we clear it to allow computing targets |
722 // for polymorphic calls. | 719 // for polymorphic calls. |
723 holder_ = Handle<JSObject>::null(); | 720 holder_ = Handle<JSObject>::null(); |
724 } | 721 } |
725 while (true) { | 722 while (true) { |
726 LookupResult lookup; | 723 LookupResult lookup(type->GetIsolate()); |
727 type->LookupInDescriptors(NULL, *name, &lookup); | 724 type->LookupInDescriptors(NULL, *name, &lookup); |
728 // If the function wasn't found directly in the map, we start | 725 // If the function wasn't found directly in the map, we start |
729 // looking upwards through the prototype chain. | 726 // looking upwards through the prototype chain. |
730 if (!lookup.IsFound() && type->prototype()->IsJSObject()) { | 727 if (!lookup.IsFound() && type->prototype()->IsJSObject()) { |
731 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); | 728 holder_ = Handle<JSObject>(JSObject::cast(type->prototype())); |
732 type = Handle<Map>(holder()->map()); | 729 type = Handle<Map>(holder()->map()); |
733 } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) { | 730 } else if (lookup.IsProperty() && lookup.type() == CONSTANT_FUNCTION) { |
734 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); | 731 target_ = Handle<JSFunction>(lookup.GetConstantFunctionFromMap(*type)); |
735 return CanCallWithoutIC(target_, arguments()->length()); | 732 return CanCallWithoutIC(target_, arguments()->length()); |
736 } else { | 733 } else { |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1191 int pos) | 1188 int pos) |
1192 : label_(label), | 1189 : label_(label), |
1193 statements_(statements), | 1190 statements_(statements), |
1194 position_(pos), | 1191 position_(pos), |
1195 compare_type_(NONE), | 1192 compare_type_(NONE), |
1196 compare_id_(AstNode::GetNextId(isolate)), | 1193 compare_id_(AstNode::GetNextId(isolate)), |
1197 entry_id_(AstNode::GetNextId(isolate)) { | 1194 entry_id_(AstNode::GetNextId(isolate)) { |
1198 } | 1195 } |
1199 | 1196 |
1200 } } // namespace v8::internal | 1197 } } // namespace v8::internal |
OLD | NEW |