Revision f230a1cf deps/v8/src/ast.cc
deps/v8/src/ast.cc | ||
---|---|---|
82 | 82 |
} |
83 | 83 |
|
84 | 84 |
|
85 |
VariableProxy::VariableProxy(Isolate* isolate, Variable* var) |
|
86 |
: Expression(isolate), |
|
85 |
VariableProxy::VariableProxy(Isolate* isolate, Variable* var, int position)
|
|
86 |
: Expression(isolate, position),
|
|
87 | 87 |
name_(var->name()), |
88 | 88 |
var_(NULL), // Will be set by the call to BindTo. |
89 | 89 |
is_this_(var->is_this()), |
90 | 90 |
is_trivial_(false), |
91 | 91 |
is_lvalue_(false), |
92 |
position_(RelocInfo::kNoPosition), |
|
93 | 92 |
interface_(var->interface()) { |
94 | 93 |
BindTo(var); |
95 | 94 |
} |
... | ... | |
100 | 99 |
bool is_this, |
101 | 100 |
Interface* interface, |
102 | 101 |
int position) |
103 |
: Expression(isolate), |
|
102 |
: Expression(isolate, position),
|
|
104 | 103 |
name_(name), |
105 | 104 |
var_(NULL), |
106 | 105 |
is_this_(is_this), |
107 | 106 |
is_trivial_(false), |
108 | 107 |
is_lvalue_(false), |
109 |
position_(position), |
|
110 | 108 |
interface_(interface) { |
111 | 109 |
// Names must be canonicalized for fast equality checks. |
112 | 110 |
ASSERT(name->IsInternalizedString()); |
... | ... | |
133 | 131 |
Expression* target, |
134 | 132 |
Expression* value, |
135 | 133 |
int pos) |
136 |
: Expression(isolate), |
|
134 |
: Expression(isolate, pos),
|
|
137 | 135 |
op_(op), |
138 | 136 |
target_(target), |
139 | 137 |
value_(value), |
140 |
pos_(pos), |
|
141 | 138 |
binary_operation_(NULL), |
142 | 139 |
assignment_id_(GetNextId(isolate)), |
143 | 140 |
is_monomorphic_(false), |
144 | 141 |
is_uninitialized_(false), |
142 |
is_pre_monomorphic_(false), |
|
145 | 143 |
store_mode_(STANDARD_STORE) { } |
146 | 144 |
|
147 | 145 |
|
... | ... | |
234 | 232 |
} |
235 | 233 |
|
236 | 234 |
|
237 |
bool IsEqualString(void* first, void* second) { |
|
238 |
ASSERT((*reinterpret_cast<String**>(first))->IsString()); |
|
239 |
ASSERT((*reinterpret_cast<String**>(second))->IsString()); |
|
240 |
Handle<String> h1(reinterpret_cast<String**>(first)); |
|
241 |
Handle<String> h2(reinterpret_cast<String**>(second)); |
|
242 |
return (*h1)->Equals(*h2); |
|
243 |
} |
|
244 |
|
|
245 |
|
|
246 |
bool IsEqualNumber(void* first, void* second) { |
|
247 |
ASSERT((*reinterpret_cast<Object**>(first))->IsNumber()); |
|
248 |
ASSERT((*reinterpret_cast<Object**>(second))->IsNumber()); |
|
249 |
|
|
250 |
Handle<Object> h1(reinterpret_cast<Object**>(first)); |
|
251 |
Handle<Object> h2(reinterpret_cast<Object**>(second)); |
|
252 |
if (h1->IsSmi()) { |
|
253 |
return h2->IsSmi() && *h1 == *h2; |
|
254 |
} |
|
255 |
if (h2->IsSmi()) return false; |
|
256 |
Handle<HeapNumber> n1 = Handle<HeapNumber>::cast(h1); |
|
257 |
Handle<HeapNumber> n2 = Handle<HeapNumber>::cast(h2); |
|
258 |
ASSERT(std::isfinite(n1->value())); |
|
259 |
ASSERT(std::isfinite(n2->value())); |
|
260 |
return n1->value() == n2->value(); |
|
261 |
} |
|
262 |
|
|
263 |
|
|
264 | 235 |
void ObjectLiteral::CalculateEmitStore(Zone* zone) { |
265 | 236 |
ZoneAllocationPolicy allocator(zone); |
266 | 237 |
|
... | ... | |
456 | 427 |
is_uninitialized_ = oracle->LoadIsUninitialized(this); |
457 | 428 |
if (is_uninitialized_) return; |
458 | 429 |
|
430 |
is_pre_monomorphic_ = oracle->LoadIsPreMonomorphic(this); |
|
459 | 431 |
is_monomorphic_ = oracle->LoadIsMonomorphicNormal(this); |
432 |
ASSERT(!is_pre_monomorphic_ || !is_monomorphic_); |
|
460 | 433 |
receiver_types_.Clear(); |
461 | 434 |
if (key()->IsPropertyName()) { |
462 | 435 |
FunctionPrototypeStub proto_stub(Code::LOAD_IC); |
463 |
StringLengthStub string_stub(Code::LOAD_IC, false); |
|
464 |
if (oracle->LoadIsStub(this, &string_stub)) { |
|
465 |
is_string_length_ = true; |
|
466 |
} else if (oracle->LoadIsStub(this, &proto_stub)) { |
|
436 |
if (oracle->LoadIsStub(this, &proto_stub)) { |
|
467 | 437 |
is_function_prototype_ = true; |
468 | 438 |
} else { |
469 | 439 |
Literal* lit_key = key()->AsLiteral(); |
... | ... | |
474 | 444 |
} else if (oracle->LoadIsBuiltin(this, Builtins::kKeyedLoadIC_String)) { |
475 | 445 |
is_string_access_ = true; |
476 | 446 |
} else if (is_monomorphic_) { |
477 |
receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), |
|
478 |
zone); |
|
447 |
receiver_types_.Add(oracle->LoadMonomorphicReceiverType(this), zone); |
|
479 | 448 |
} else if (oracle->LoadIsPolymorphic(this)) { |
480 | 449 |
receiver_types_.Reserve(kMaxKeyedPolymorphism, zone); |
481 | 450 |
oracle->CollectKeyedReceiverTypes(PropertyFeedbackId(), &receiver_types_); |
... | ... | |
490 | 459 |
TypeFeedbackId id = AssignmentFeedbackId(); |
491 | 460 |
is_uninitialized_ = oracle->StoreIsUninitialized(id); |
492 | 461 |
if (is_uninitialized_) return; |
462 |
|
|
463 |
is_pre_monomorphic_ = oracle->StoreIsPreMonomorphic(id); |
|
493 | 464 |
is_monomorphic_ = oracle->StoreIsMonomorphicNormal(id); |
465 |
ASSERT(!is_pre_monomorphic_ || !is_monomorphic_); |
|
494 | 466 |
receiver_types_.Clear(); |
495 | 467 |
if (prop->key()->IsPropertyName()) { |
496 | 468 |
Literal* lit_key = prop->key()->AsLiteral(); |
... | ... | |
655 | 627 |
holder_ = GetPrototypeForPrimitiveCheck(check_type_, oracle->isolate()); |
656 | 628 |
receiver_types_.Add(handle(holder_->map()), oracle->zone()); |
657 | 629 |
} |
658 |
#ifdef DEBUG
|
|
630 |
#ifdef ENABLE_SLOW_ASSERTS
|
|
659 | 631 |
if (FLAG_enable_slow_asserts) { |
660 | 632 |
int length = receiver_types_.length(); |
661 | 633 |
for (int i = 0; i < length; i++) { |
... | ... | |
1067 | 1039 |
Expression* label, |
1068 | 1040 |
ZoneList<Statement*>* statements, |
1069 | 1041 |
int pos) |
1070 |
: label_(label), |
|
1042 |
: AstNode(pos), |
|
1043 |
label_(label), |
|
1071 | 1044 |
statements_(statements), |
1072 |
position_(pos), |
|
1073 | 1045 |
compare_type_(Type::None(), isolate), |
1074 | 1046 |
compare_id_(AstNode::GetNextId(isolate)), |
1075 | 1047 |
entry_id_(AstNode::GetNextId(isolate)) { |
... | ... | |
1111 | 1083 |
REGULAR_NODE(BreakStatement) |
1112 | 1084 |
REGULAR_NODE(ReturnStatement) |
1113 | 1085 |
REGULAR_NODE(SwitchStatement) |
1086 |
REGULAR_NODE(CaseClause) |
|
1114 | 1087 |
REGULAR_NODE(Conditional) |
1115 | 1088 |
REGULAR_NODE(Literal) |
1116 | 1089 |
REGULAR_NODE(ArrayLiteral) |
... | ... | |
1146 | 1119 |
DONT_OPTIMIZE_NODE(TryCatchStatement) |
1147 | 1120 |
DONT_OPTIMIZE_NODE(TryFinallyStatement) |
1148 | 1121 |
DONT_OPTIMIZE_NODE(DebuggerStatement) |
1149 |
DONT_OPTIMIZE_NODE(SharedFunctionInfoLiteral)
|
|
1122 |
DONT_OPTIMIZE_NODE(NativeFunctionLiteral)
|
|
1150 | 1123 |
|
1151 | 1124 |
DONT_SELFOPTIMIZE_NODE(DoWhileStatement) |
1152 | 1125 |
DONT_SELFOPTIMIZE_NODE(WhileStatement) |
Also available in: Unified diff