Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
| 10 #include "src/compiler/js-type-feedback.h" | 10 #include "src/compiler/js-type-feedback.h" |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 if (!function_closure_.is_set()) { | 457 if (!function_closure_.is_set()) { |
| 458 const Operator* op = common()->Parameter( | 458 const Operator* op = common()->Parameter( |
| 459 Linkage::kJSFunctionCallClosureParamIndex, "%closure"); | 459 Linkage::kJSFunctionCallClosureParamIndex, "%closure"); |
| 460 Node* node = NewNode(op, graph()->start()); | 460 Node* node = NewNode(op, graph()->start()); |
| 461 function_closure_.set(node); | 461 function_closure_.set(node); |
| 462 } | 462 } |
| 463 return function_closure_.get(); | 463 return function_closure_.get(); |
| 464 } | 464 } |
| 465 | 465 |
| 466 | 466 |
| 467 Node* AstGraphBuilder::GetFeedbackVector() { | |
| 468 if (!feedback_vector_.is_set()) { | |
| 469 Node* vector = | |
| 470 jsgraph()->Constant(handle(info()->shared_info()->feedback_vector())); | |
| 471 feedback_vector_.set(vector); | |
| 472 } | |
| 473 return feedback_vector_.get(); | |
| 474 } | |
| 475 | |
| 476 | |
| 467 void AstGraphBuilder::CreateFunctionContext(bool constant_context) { | 477 void AstGraphBuilder::CreateFunctionContext(bool constant_context) { |
| 468 function_context_.set(constant_context | 478 function_context_.set(constant_context |
| 469 ? jsgraph()->HeapConstant(info()->context()) | 479 ? jsgraph()->HeapConstant(info()->context()) |
| 470 : NewOuterContextParam()); | 480 : NewOuterContextParam()); |
| 471 } | 481 } |
| 472 | 482 |
| 473 | 483 |
| 474 Node* AstGraphBuilder::NewOuterContextParam() { | 484 Node* AstGraphBuilder::NewOuterContextParam() { |
| 475 // Parameter (arity + 1) is special for the outer context of the function | 485 // Parameter (arity + 1) is special for the outer context of the function |
| 476 const Operator* op = | 486 const Operator* op = |
| (...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1644 compare_if.Then(); | 1654 compare_if.Then(); |
| 1645 Visit(expr->then_expression()); | 1655 Visit(expr->then_expression()); |
| 1646 compare_if.Else(); | 1656 compare_if.Else(); |
| 1647 Visit(expr->else_expression()); | 1657 Visit(expr->else_expression()); |
| 1648 compare_if.End(); | 1658 compare_if.End(); |
| 1649 ast_context()->ReplaceValue(); | 1659 ast_context()->ReplaceValue(); |
| 1650 } | 1660 } |
| 1651 | 1661 |
| 1652 | 1662 |
| 1653 void AstGraphBuilder::VisitVariableProxy(VariableProxy* expr) { | 1663 void AstGraphBuilder::VisitVariableProxy(VariableProxy* expr) { |
| 1654 VectorSlotPair pair = CreateVectorSlotPair(expr->VariableFeedbackSlot()); | 1664 ResolvedFeedbackSlot slot = |
| 1665 CreateResolvedFeedbackSlot(expr->VariableFeedbackSlot()); | |
| 1655 FrameStateBeforeAndAfter states(this, BeforeId(expr)); | 1666 FrameStateBeforeAndAfter states(this, BeforeId(expr)); |
| 1656 Node* value = BuildVariableLoad(expr->var(), expr->id(), states, pair, | 1667 Node* value = BuildVariableLoad(expr->var(), expr->id(), states, slot, |
| 1657 ast_context()->GetStateCombine()); | 1668 ast_context()->GetStateCombine()); |
| 1658 ast_context()->ProduceValue(value); | 1669 ast_context()->ProduceValue(value); |
| 1659 } | 1670 } |
| 1660 | 1671 |
| 1661 | 1672 |
| 1662 void AstGraphBuilder::VisitLiteral(Literal* expr) { | 1673 void AstGraphBuilder::VisitLiteral(Literal* expr) { |
| 1663 Node* value = jsgraph()->Constant(expr->value()); | 1674 Node* value = jsgraph()->Constant(expr->value()); |
| 1664 ast_context()->ProduceValue(value); | 1675 ast_context()->ProduceValue(value); |
| 1665 } | 1676 } |
| 1666 | 1677 |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2062 } | 2073 } |
| 2063 | 2074 |
| 2064 BailoutId before_store_id = BailoutId::None(); | 2075 BailoutId before_store_id = BailoutId::None(); |
| 2065 // Evaluate the value and potentially handle compound assignments by loading | 2076 // Evaluate the value and potentially handle compound assignments by loading |
| 2066 // the left-hand side value and performing a binary operation. | 2077 // the left-hand side value and performing a binary operation. |
| 2067 if (expr->is_compound()) { | 2078 if (expr->is_compound()) { |
| 2068 Node* old_value = NULL; | 2079 Node* old_value = NULL; |
| 2069 switch (assign_type) { | 2080 switch (assign_type) { |
| 2070 case VARIABLE: { | 2081 case VARIABLE: { |
| 2071 VariableProxy* proxy = expr->target()->AsVariableProxy(); | 2082 VariableProxy* proxy = expr->target()->AsVariableProxy(); |
| 2072 VectorSlotPair pair = | 2083 ResolvedFeedbackSlot slot = |
| 2073 CreateVectorSlotPair(proxy->VariableFeedbackSlot()); | 2084 CreateResolvedFeedbackSlot(proxy->VariableFeedbackSlot()); |
| 2074 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); | 2085 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); |
| 2075 old_value = | 2086 old_value = |
| 2076 BuildVariableLoad(proxy->var(), expr->target()->id(), states, pair, | 2087 BuildVariableLoad(proxy->var(), expr->target()->id(), states, slot, |
| 2077 OutputFrameStateCombine::Push()); | 2088 OutputFrameStateCombine::Push()); |
| 2078 break; | 2089 break; |
| 2079 } | 2090 } |
| 2080 case NAMED_PROPERTY: { | 2091 case NAMED_PROPERTY: { |
| 2081 Node* object = environment()->Top(); | 2092 Node* object = environment()->Top(); |
| 2082 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2093 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
| 2083 VectorSlotPair pair = | 2094 ResolvedFeedbackSlot slot = |
| 2084 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2095 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2085 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2096 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2086 old_value = BuildNamedLoad(object, name, pair); | 2097 old_value = BuildNamedLoad(object, GetFeedbackVector(), name, slot); |
| 2087 states.AddToNode(old_value, property->LoadId(), | 2098 states.AddToNode(old_value, property->LoadId(), |
| 2088 OutputFrameStateCombine::Push()); | 2099 OutputFrameStateCombine::Push()); |
| 2089 break; | 2100 break; |
| 2090 } | 2101 } |
| 2091 case KEYED_PROPERTY: { | 2102 case KEYED_PROPERTY: { |
| 2092 Node* key = environment()->Top(); | 2103 Node* key = environment()->Top(); |
| 2093 Node* object = environment()->Peek(1); | 2104 Node* object = environment()->Peek(1); |
| 2094 VectorSlotPair pair = | 2105 ResolvedFeedbackSlot slot = |
| 2095 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2106 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2096 FrameStateBeforeAndAfter states(this, property->key()->id()); | 2107 FrameStateBeforeAndAfter states(this, property->key()->id()); |
| 2097 old_value = BuildKeyedLoad(object, key, pair); | 2108 old_value = BuildKeyedLoad(object, key, GetFeedbackVector(), slot); |
| 2098 states.AddToNode(old_value, property->LoadId(), | 2109 states.AddToNode(old_value, property->LoadId(), |
| 2099 OutputFrameStateCombine::Push()); | 2110 OutputFrameStateCombine::Push()); |
| 2100 break; | 2111 break; |
| 2101 } | 2112 } |
| 2102 case NAMED_SUPER_PROPERTY: { | 2113 case NAMED_SUPER_PROPERTY: { |
| 2103 Node* home_object = environment()->Top(); | 2114 Node* home_object = environment()->Top(); |
| 2104 Node* receiver = environment()->Peek(1); | 2115 Node* receiver = environment()->Peek(1); |
| 2105 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2116 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
| 2106 VectorSlotPair pair = | 2117 ResolvedFeedbackSlot slot = |
| 2107 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2118 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2108 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2119 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2109 old_value = BuildNamedSuperLoad(receiver, home_object, name, pair); | 2120 old_value = BuildNamedSuperLoad(receiver, home_object, name, slot); |
| 2110 states.AddToNode(old_value, property->LoadId(), | 2121 states.AddToNode(old_value, property->LoadId(), |
| 2111 OutputFrameStateCombine::Push()); | 2122 OutputFrameStateCombine::Push()); |
| 2112 break; | 2123 break; |
| 2113 } | 2124 } |
| 2114 case KEYED_SUPER_PROPERTY: { | 2125 case KEYED_SUPER_PROPERTY: { |
| 2115 Node* key = environment()->Top(); | 2126 Node* key = environment()->Top(); |
| 2116 Node* home_object = environment()->Peek(1); | 2127 Node* home_object = environment()->Peek(1); |
| 2117 Node* receiver = environment()->Peek(2); | 2128 Node* receiver = environment()->Peek(2); |
| 2118 VectorSlotPair pair = | 2129 ResolvedFeedbackSlot slot = |
| 2119 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2130 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2120 FrameStateBeforeAndAfter states(this, property->key()->id()); | 2131 FrameStateBeforeAndAfter states(this, property->key()->id()); |
| 2121 old_value = BuildKeyedSuperLoad(receiver, home_object, key, pair); | 2132 old_value = BuildKeyedSuperLoad(receiver, home_object, key, slot); |
| 2122 states.AddToNode(old_value, property->LoadId(), | 2133 states.AddToNode(old_value, property->LoadId(), |
| 2123 OutputFrameStateCombine::Push()); | 2134 OutputFrameStateCombine::Push()); |
| 2124 break; | 2135 break; |
| 2125 } | 2136 } |
| 2126 } | 2137 } |
| 2127 environment()->Push(old_value); | 2138 environment()->Push(old_value); |
| 2128 VisitForValue(expr->value()); | 2139 VisitForValue(expr->value()); |
| 2129 Node* value; | 2140 Node* value; |
| 2130 { | 2141 { |
| 2131 FrameStateBeforeAndAfter states(this, expr->value()->id()); | 2142 FrameStateBeforeAndAfter states(this, expr->value()->id()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2211 VisitForValue(expr->exception()); | 2222 VisitForValue(expr->exception()); |
| 2212 Node* exception = environment()->Pop(); | 2223 Node* exception = environment()->Pop(); |
| 2213 Node* value = BuildThrowError(exception, expr->id()); | 2224 Node* value = BuildThrowError(exception, expr->id()); |
| 2214 ast_context()->ProduceValue(value); | 2225 ast_context()->ProduceValue(value); |
| 2215 } | 2226 } |
| 2216 | 2227 |
| 2217 | 2228 |
| 2218 void AstGraphBuilder::VisitProperty(Property* expr) { | 2229 void AstGraphBuilder::VisitProperty(Property* expr) { |
| 2219 Node* value = nullptr; | 2230 Node* value = nullptr; |
| 2220 LhsKind property_kind = Property::GetAssignType(expr); | 2231 LhsKind property_kind = Property::GetAssignType(expr); |
| 2221 VectorSlotPair pair = CreateVectorSlotPair(expr->PropertyFeedbackSlot()); | 2232 ResolvedFeedbackSlot slot = |
| 2233 CreateResolvedFeedbackSlot(expr->PropertyFeedbackSlot()); | |
| 2222 switch (property_kind) { | 2234 switch (property_kind) { |
| 2223 case VARIABLE: | 2235 case VARIABLE: |
| 2224 UNREACHABLE(); | 2236 UNREACHABLE(); |
| 2225 break; | 2237 break; |
| 2226 case NAMED_PROPERTY: { | 2238 case NAMED_PROPERTY: { |
| 2227 VisitForValue(expr->obj()); | 2239 VisitForValue(expr->obj()); |
| 2228 FrameStateBeforeAndAfter states(this, expr->obj()->id()); | 2240 FrameStateBeforeAndAfter states(this, expr->obj()->id()); |
| 2229 Node* object = environment()->Pop(); | 2241 Node* object = environment()->Pop(); |
| 2230 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); | 2242 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); |
| 2231 value = BuildNamedLoad(object, name, pair); | 2243 value = BuildNamedLoad(object, GetFeedbackVector(), name, slot); |
| 2232 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); | 2244 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); |
| 2233 break; | 2245 break; |
| 2234 } | 2246 } |
| 2235 case KEYED_PROPERTY: { | 2247 case KEYED_PROPERTY: { |
| 2236 VisitForValue(expr->obj()); | 2248 VisitForValue(expr->obj()); |
| 2237 VisitForValue(expr->key()); | 2249 VisitForValue(expr->key()); |
| 2238 FrameStateBeforeAndAfter states(this, expr->key()->id()); | 2250 FrameStateBeforeAndAfter states(this, expr->key()->id()); |
| 2239 Node* key = environment()->Pop(); | 2251 Node* key = environment()->Pop(); |
| 2240 Node* object = environment()->Pop(); | 2252 Node* object = environment()->Pop(); |
| 2241 value = BuildKeyedLoad(object, key, pair); | 2253 value = BuildKeyedLoad(object, key, GetFeedbackVector(), slot); |
| 2242 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); | 2254 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); |
| 2243 break; | 2255 break; |
| 2244 } | 2256 } |
| 2245 case NAMED_SUPER_PROPERTY: { | 2257 case NAMED_SUPER_PROPERTY: { |
| 2246 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2258 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
| 2247 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); | 2259 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); |
| 2248 FrameStateBeforeAndAfter states(this, expr->obj()->id()); | 2260 FrameStateBeforeAndAfter states(this, expr->obj()->id()); |
| 2249 Node* home_object = environment()->Pop(); | 2261 Node* home_object = environment()->Pop(); |
| 2250 Node* receiver = environment()->Pop(); | 2262 Node* receiver = environment()->Pop(); |
| 2251 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); | 2263 Handle<Name> name = expr->key()->AsLiteral()->AsPropertyName(); |
| 2252 value = BuildNamedSuperLoad(receiver, home_object, name, pair); | 2264 value = BuildNamedSuperLoad(receiver, home_object, name, slot); |
| 2253 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); | 2265 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); |
| 2254 break; | 2266 break; |
| 2255 } | 2267 } |
| 2256 case KEYED_SUPER_PROPERTY: { | 2268 case KEYED_SUPER_PROPERTY: { |
| 2257 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2269 VisitForValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
| 2258 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); | 2270 VisitForValue(expr->obj()->AsSuperPropertyReference()->home_object()); |
| 2259 VisitForValue(expr->key()); | 2271 VisitForValue(expr->key()); |
| 2260 FrameStateBeforeAndAfter states(this, expr->key()->id()); | 2272 FrameStateBeforeAndAfter states(this, expr->key()->id()); |
| 2261 Node* key = environment()->Pop(); | 2273 Node* key = environment()->Pop(); |
| 2262 Node* home_object = environment()->Pop(); | 2274 Node* home_object = environment()->Pop(); |
| 2263 Node* receiver = environment()->Pop(); | 2275 Node* receiver = environment()->Pop(); |
| 2264 value = BuildKeyedSuperLoad(receiver, home_object, key, pair); | 2276 value = BuildKeyedSuperLoad(receiver, home_object, key, slot); |
| 2265 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); | 2277 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); |
| 2266 break; | 2278 break; |
| 2267 } | 2279 } |
| 2268 } | 2280 } |
| 2269 ast_context()->ProduceValue(value); | 2281 ast_context()->ProduceValue(value); |
| 2270 } | 2282 } |
| 2271 | 2283 |
| 2272 | 2284 |
| 2273 void AstGraphBuilder::VisitCall(Call* expr) { | 2285 void AstGraphBuilder::VisitCall(Call* expr) { |
| 2274 Expression* callee = expr->expression(); | 2286 Expression* callee = expr->expression(); |
| 2275 Call::CallType call_type = expr->GetCallType(isolate()); | 2287 Call::CallType call_type = expr->GetCallType(isolate()); |
| 2276 | 2288 |
| 2277 // Prepare the callee and the receiver to the function call. This depends on | 2289 // Prepare the callee and the receiver to the function call. This depends on |
| 2278 // the semantics of the underlying call type. | 2290 // the semantics of the underlying call type. |
| 2279 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS; | 2291 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS; |
| 2280 Node* receiver_value = NULL; | 2292 Node* receiver_value = NULL; |
| 2281 Node* callee_value = NULL; | 2293 Node* callee_value = NULL; |
| 2282 bool possibly_eval = false; | 2294 bool possibly_eval = false; |
| 2283 switch (call_type) { | 2295 switch (call_type) { |
| 2284 case Call::GLOBAL_CALL: { | 2296 case Call::GLOBAL_CALL: { |
| 2285 VariableProxy* proxy = callee->AsVariableProxy(); | 2297 VariableProxy* proxy = callee->AsVariableProxy(); |
| 2286 VectorSlotPair pair = CreateVectorSlotPair(proxy->VariableFeedbackSlot()); | 2298 ResolvedFeedbackSlot slot = |
| 2299 CreateResolvedFeedbackSlot(proxy->VariableFeedbackSlot()); | |
| 2287 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); | 2300 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); |
| 2288 callee_value = | 2301 callee_value = |
| 2289 BuildVariableLoad(proxy->var(), expr->expression()->id(), states, | 2302 BuildVariableLoad(proxy->var(), expr->expression()->id(), states, |
| 2290 pair, OutputFrameStateCombine::Push()); | 2303 slot, OutputFrameStateCombine::Push()); |
| 2291 receiver_value = jsgraph()->UndefinedConstant(); | 2304 receiver_value = jsgraph()->UndefinedConstant(); |
| 2292 break; | 2305 break; |
| 2293 } | 2306 } |
| 2294 case Call::LOOKUP_SLOT_CALL: { | 2307 case Call::LOOKUP_SLOT_CALL: { |
| 2295 Variable* variable = callee->AsVariableProxy()->var(); | 2308 Variable* variable = callee->AsVariableProxy()->var(); |
| 2296 DCHECK(variable->location() == Variable::LOOKUP); | 2309 DCHECK(variable->location() == Variable::LOOKUP); |
| 2297 Node* name = jsgraph()->Constant(variable->name()); | 2310 Node* name = jsgraph()->Constant(variable->name()); |
| 2298 const Operator* op = | 2311 const Operator* op = |
| 2299 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); | 2312 javascript()->CallRuntime(Runtime::kLoadLookupSlot, 2); |
| 2300 Node* pair = NewNode(op, current_context(), name); | 2313 Node* pair = NewNode(op, current_context(), name); |
| 2301 callee_value = NewNode(common()->Projection(0), pair); | 2314 callee_value = NewNode(common()->Projection(0), pair); |
| 2302 receiver_value = NewNode(common()->Projection(1), pair); | 2315 receiver_value = NewNode(common()->Projection(1), pair); |
| 2303 | 2316 |
| 2304 PrepareFrameState(pair, expr->EvalOrLookupId(), | 2317 PrepareFrameState(pair, expr->EvalOrLookupId(), |
| 2305 OutputFrameStateCombine::Push(2)); | 2318 OutputFrameStateCombine::Push(2)); |
| 2306 break; | 2319 break; |
| 2307 } | 2320 } |
| 2308 case Call::PROPERTY_CALL: { | 2321 case Call::PROPERTY_CALL: { |
| 2309 Property* property = callee->AsProperty(); | 2322 Property* property = callee->AsProperty(); |
| 2310 VectorSlotPair pair = | 2323 ResolvedFeedbackSlot slot = |
| 2311 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2324 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2312 if (!property->IsSuperAccess()) { | 2325 if (!property->IsSuperAccess()) { |
| 2313 VisitForValue(property->obj()); | 2326 VisitForValue(property->obj()); |
| 2314 Node* object = environment()->Top(); | 2327 Node* object = environment()->Top(); |
| 2315 | 2328 |
| 2316 if (property->key()->IsPropertyName()) { | 2329 if (property->key()->IsPropertyName()) { |
| 2317 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2330 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2318 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2331 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
| 2319 callee_value = BuildNamedLoad(object, name, pair); | 2332 callee_value = |
| 2333 BuildNamedLoad(object, GetFeedbackVector(), name, slot); | |
| 2320 states.AddToNode(callee_value, property->LoadId(), | 2334 states.AddToNode(callee_value, property->LoadId(), |
| 2321 OutputFrameStateCombine::Push()); | 2335 OutputFrameStateCombine::Push()); |
| 2322 } else { | 2336 } else { |
| 2323 VisitForValue(property->key()); | 2337 VisitForValue(property->key()); |
| 2324 FrameStateBeforeAndAfter states(this, property->key()->id()); | 2338 FrameStateBeforeAndAfter states(this, property->key()->id()); |
| 2325 Node* key = environment()->Pop(); | 2339 Node* key = environment()->Pop(); |
| 2326 callee_value = BuildKeyedLoad(object, key, pair); | 2340 callee_value = BuildKeyedLoad(object, key, GetFeedbackVector(), slot); |
| 2327 states.AddToNode(callee_value, property->LoadId(), | 2341 states.AddToNode(callee_value, property->LoadId(), |
| 2328 OutputFrameStateCombine::Push()); | 2342 OutputFrameStateCombine::Push()); |
| 2329 } | 2343 } |
| 2330 receiver_value = environment()->Pop(); | 2344 receiver_value = environment()->Pop(); |
| 2331 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an | 2345 // Note that a PROPERTY_CALL requires the receiver to be wrapped into an |
| 2332 // object for sloppy callees. This could also be modeled explicitly | 2346 // object for sloppy callees. This could also be modeled explicitly |
| 2333 // here, | 2347 // here, |
| 2334 // thereby obsoleting the need for a flag to the call operator. | 2348 // thereby obsoleting the need for a flag to the call operator. |
| 2335 flags = CALL_AS_METHOD; | 2349 flags = CALL_AS_METHOD; |
| 2336 | 2350 |
| 2337 } else { | 2351 } else { |
| 2338 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | 2352 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); |
| 2339 VisitForValue( | 2353 VisitForValue( |
| 2340 property->obj()->AsSuperPropertyReference()->home_object()); | 2354 property->obj()->AsSuperPropertyReference()->home_object()); |
| 2341 Node* home_object = environment()->Pop(); | 2355 Node* home_object = environment()->Pop(); |
| 2342 receiver_value = environment()->Pop(); | 2356 receiver_value = environment()->Pop(); |
| 2343 if (property->key()->IsPropertyName()) { | 2357 if (property->key()->IsPropertyName()) { |
| 2344 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2358 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2345 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2359 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
| 2346 callee_value = | 2360 callee_value = |
| 2347 BuildNamedSuperLoad(receiver_value, home_object, name, pair); | 2361 BuildNamedSuperLoad(receiver_value, home_object, name, slot); |
| 2348 states.AddToNode(callee_value, property->LoadId(), | 2362 states.AddToNode(callee_value, property->LoadId(), |
| 2349 OutputFrameStateCombine::Push()); | 2363 OutputFrameStateCombine::Push()); |
| 2350 | 2364 |
| 2351 } else { | 2365 } else { |
| 2352 VisitForValue(property->key()); | 2366 VisitForValue(property->key()); |
| 2353 FrameStateBeforeAndAfter states(this, property->key()->id()); | 2367 FrameStateBeforeAndAfter states(this, property->key()->id()); |
| 2354 Node* key = environment()->Pop(); | 2368 Node* key = environment()->Pop(); |
| 2355 callee_value = | 2369 callee_value = |
| 2356 BuildKeyedSuperLoad(receiver_value, home_object, key, pair); | 2370 BuildKeyedSuperLoad(receiver_value, home_object, key, slot); |
| 2357 states.AddToNode(callee_value, property->LoadId(), | 2371 states.AddToNode(callee_value, property->LoadId(), |
| 2358 OutputFrameStateCombine::Push()); | 2372 OutputFrameStateCombine::Push()); |
| 2359 } | 2373 } |
| 2360 } | 2374 } |
| 2361 | 2375 |
| 2362 break; | 2376 break; |
| 2363 } | 2377 } |
| 2364 case Call::SUPER_CALL: | 2378 case Call::SUPER_CALL: |
| 2365 // TODO(dslomov): Implement super calls. | 2379 // TODO(dslomov): Implement super calls. |
| 2366 callee_value = jsgraph()->UndefinedConstant(); | 2380 callee_value = jsgraph()->UndefinedConstant(); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2455 } | 2469 } |
| 2456 | 2470 |
| 2457 | 2471 |
| 2458 void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { | 2472 void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { |
| 2459 Handle<String> name = expr->name(); | 2473 Handle<String> name = expr->name(); |
| 2460 | 2474 |
| 2461 // The callee and the receiver both have to be pushed onto the operand stack | 2475 // The callee and the receiver both have to be pushed onto the operand stack |
| 2462 // before arguments are being evaluated. | 2476 // before arguments are being evaluated. |
| 2463 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS; | 2477 CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS; |
| 2464 Node* receiver_value = BuildLoadBuiltinsObject(); | 2478 Node* receiver_value = BuildLoadBuiltinsObject(); |
| 2465 VectorSlotPair pair = CreateVectorSlotPair(expr->CallRuntimeFeedbackSlot()); | 2479 ResolvedFeedbackSlot slot = |
| 2480 CreateResolvedFeedbackSlot(expr->CallRuntimeFeedbackSlot()); | |
| 2466 // TODO(jarin): bailout ids for runtime calls. | 2481 // TODO(jarin): bailout ids for runtime calls. |
| 2467 FrameStateBeforeAndAfter states(this, BailoutId::None()); | 2482 FrameStateBeforeAndAfter states(this, BailoutId::None()); |
| 2468 Node* callee_value = BuildNamedLoad(receiver_value, name, pair); | 2483 Node* callee_value = |
| 2484 BuildNamedLoad(receiver_value, GetFeedbackVector(), name, slot); | |
| 2469 states.AddToNode(callee_value, BailoutId::None(), | 2485 states.AddToNode(callee_value, BailoutId::None(), |
| 2470 OutputFrameStateCombine::Push()); | 2486 OutputFrameStateCombine::Push()); |
| 2471 environment()->Push(callee_value); | 2487 environment()->Push(callee_value); |
| 2472 environment()->Push(receiver_value); | 2488 environment()->Push(receiver_value); |
| 2473 | 2489 |
| 2474 // Evaluate all arguments to the JS runtime call. | 2490 // Evaluate all arguments to the JS runtime call. |
| 2475 ZoneList<Expression*>* args = expr->arguments(); | 2491 ZoneList<Expression*>* args = expr->arguments(); |
| 2476 VisitForValues(args); | 2492 VisitForValues(args); |
| 2477 | 2493 |
| 2478 // Create node to perform the JS runtime call. | 2494 // Create node to perform the JS runtime call. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2533 // Reserve space for result of postfix operation. | 2549 // Reserve space for result of postfix operation. |
| 2534 bool is_postfix = expr->is_postfix() && !ast_context()->IsEffect(); | 2550 bool is_postfix = expr->is_postfix() && !ast_context()->IsEffect(); |
| 2535 if (is_postfix) environment()->Push(jsgraph()->UndefinedConstant()); | 2551 if (is_postfix) environment()->Push(jsgraph()->UndefinedConstant()); |
| 2536 | 2552 |
| 2537 // Evaluate LHS expression and get old value. | 2553 // Evaluate LHS expression and get old value. |
| 2538 Node* old_value = NULL; | 2554 Node* old_value = NULL; |
| 2539 int stack_depth = -1; | 2555 int stack_depth = -1; |
| 2540 switch (assign_type) { | 2556 switch (assign_type) { |
| 2541 case VARIABLE: { | 2557 case VARIABLE: { |
| 2542 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 2558 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
| 2543 VectorSlotPair pair = CreateVectorSlotPair(proxy->VariableFeedbackSlot()); | 2559 ResolvedFeedbackSlot slot = |
| 2560 CreateResolvedFeedbackSlot(proxy->VariableFeedbackSlot()); | |
| 2544 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); | 2561 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); |
| 2545 old_value = | 2562 old_value = |
| 2546 BuildVariableLoad(proxy->var(), expr->expression()->id(), states, | 2563 BuildVariableLoad(proxy->var(), expr->expression()->id(), states, |
| 2547 pair, OutputFrameStateCombine::Push()); | 2564 slot, OutputFrameStateCombine::Push()); |
| 2548 stack_depth = 0; | 2565 stack_depth = 0; |
| 2549 break; | 2566 break; |
| 2550 } | 2567 } |
| 2551 case NAMED_PROPERTY: { | 2568 case NAMED_PROPERTY: { |
| 2552 VisitForValue(property->obj()); | 2569 VisitForValue(property->obj()); |
| 2553 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2570 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2554 Node* object = environment()->Top(); | 2571 Node* object = environment()->Top(); |
| 2555 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2572 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
| 2556 VectorSlotPair pair = | 2573 ResolvedFeedbackSlot slot = |
| 2557 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2574 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2558 old_value = BuildNamedLoad(object, name, pair); | 2575 old_value = BuildNamedLoad(object, GetFeedbackVector(), name, slot); |
| 2559 states.AddToNode(old_value, property->LoadId(), | 2576 states.AddToNode(old_value, property->LoadId(), |
| 2560 OutputFrameStateCombine::Push()); | 2577 OutputFrameStateCombine::Push()); |
| 2561 stack_depth = 1; | 2578 stack_depth = 1; |
| 2562 break; | 2579 break; |
| 2563 } | 2580 } |
| 2564 case KEYED_PROPERTY: { | 2581 case KEYED_PROPERTY: { |
| 2565 VisitForValue(property->obj()); | 2582 VisitForValue(property->obj()); |
| 2566 VisitForValue(property->key()); | 2583 VisitForValue(property->key()); |
| 2567 FrameStateBeforeAndAfter states(this, property->key()->id()); | 2584 FrameStateBeforeAndAfter states(this, property->key()->id()); |
| 2568 Node* key = environment()->Top(); | 2585 Node* key = environment()->Top(); |
| 2569 Node* object = environment()->Peek(1); | 2586 Node* object = environment()->Peek(1); |
| 2570 VectorSlotPair pair = | 2587 ResolvedFeedbackSlot slot = |
| 2571 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2588 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2572 old_value = BuildKeyedLoad(object, key, pair); | 2589 old_value = BuildKeyedLoad(object, key, GetFeedbackVector(), slot); |
| 2573 states.AddToNode(old_value, property->LoadId(), | 2590 states.AddToNode(old_value, property->LoadId(), |
| 2574 OutputFrameStateCombine::Push()); | 2591 OutputFrameStateCombine::Push()); |
| 2575 stack_depth = 2; | 2592 stack_depth = 2; |
| 2576 break; | 2593 break; |
| 2577 } | 2594 } |
| 2578 case NAMED_SUPER_PROPERTY: { | 2595 case NAMED_SUPER_PROPERTY: { |
| 2579 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | 2596 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); |
| 2580 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | 2597 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); |
| 2581 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2598 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2582 Node* home_object = environment()->Top(); | 2599 Node* home_object = environment()->Top(); |
| 2583 Node* receiver = environment()->Peek(1); | 2600 Node* receiver = environment()->Peek(1); |
| 2584 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); | 2601 Handle<Name> name = property->key()->AsLiteral()->AsPropertyName(); |
| 2585 VectorSlotPair pair = | 2602 ResolvedFeedbackSlot slot = |
| 2586 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2603 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2587 old_value = BuildNamedSuperLoad(receiver, home_object, name, pair); | 2604 old_value = BuildNamedSuperLoad(receiver, home_object, name, slot); |
| 2588 states.AddToNode(old_value, property->LoadId(), | 2605 states.AddToNode(old_value, property->LoadId(), |
| 2589 OutputFrameStateCombine::Push()); | 2606 OutputFrameStateCombine::Push()); |
| 2590 stack_depth = 2; | 2607 stack_depth = 2; |
| 2591 break; | 2608 break; |
| 2592 } | 2609 } |
| 2593 case KEYED_SUPER_PROPERTY: { | 2610 case KEYED_SUPER_PROPERTY: { |
| 2594 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); | 2611 VisitForValue(property->obj()->AsSuperPropertyReference()->this_var()); |
| 2595 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); | 2612 VisitForValue(property->obj()->AsSuperPropertyReference()->home_object()); |
| 2596 VisitForValue(property->key()); | 2613 VisitForValue(property->key()); |
| 2597 FrameStateBeforeAndAfter states(this, property->obj()->id()); | 2614 FrameStateBeforeAndAfter states(this, property->obj()->id()); |
| 2598 Node* key = environment()->Top(); | 2615 Node* key = environment()->Top(); |
| 2599 Node* home_object = environment()->Peek(1); | 2616 Node* home_object = environment()->Peek(1); |
| 2600 Node* receiver = environment()->Peek(2); | 2617 Node* receiver = environment()->Peek(2); |
| 2601 VectorSlotPair pair = | 2618 ResolvedFeedbackSlot slot = |
| 2602 CreateVectorSlotPair(property->PropertyFeedbackSlot()); | 2619 CreateResolvedFeedbackSlot(property->PropertyFeedbackSlot()); |
| 2603 old_value = BuildKeyedSuperLoad(receiver, home_object, key, pair); | 2620 old_value = BuildKeyedSuperLoad(receiver, home_object, key, slot); |
| 2604 states.AddToNode(old_value, property->LoadId(), | 2621 states.AddToNode(old_value, property->LoadId(), |
| 2605 OutputFrameStateCombine::Push()); | 2622 OutputFrameStateCombine::Push()); |
| 2606 stack_depth = 3; | 2623 stack_depth = 3; |
| 2607 break; | 2624 break; |
| 2608 } | 2625 } |
| 2609 } | 2626 } |
| 2610 | 2627 |
| 2611 // Convert old value into a number. | 2628 // Convert old value into a number. |
| 2612 old_value = NewNode(javascript()->ToNumber(), old_value); | 2629 old_value = NewNode(javascript()->ToNumber(), old_value); |
| 2613 PrepareFrameState(old_value, expr->ToNumberId(), | 2630 PrepareFrameState(old_value, expr->ToNumberId(), |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2864 ast_context()->ProduceValue(value); | 2881 ast_context()->ProduceValue(value); |
| 2865 } | 2882 } |
| 2866 | 2883 |
| 2867 | 2884 |
| 2868 void AstGraphBuilder::VisitTypeof(UnaryOperation* expr) { | 2885 void AstGraphBuilder::VisitTypeof(UnaryOperation* expr) { |
| 2869 Node* operand; | 2886 Node* operand; |
| 2870 if (expr->expression()->IsVariableProxy()) { | 2887 if (expr->expression()->IsVariableProxy()) { |
| 2871 // Typeof does not throw a reference error on global variables, hence we | 2888 // Typeof does not throw a reference error on global variables, hence we |
| 2872 // perform a non-contextual load in case the operand is a variable proxy. | 2889 // perform a non-contextual load in case the operand is a variable proxy. |
| 2873 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 2890 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
| 2874 VectorSlotPair pair = CreateVectorSlotPair(proxy->VariableFeedbackSlot()); | 2891 ResolvedFeedbackSlot slot = |
| 2892 CreateResolvedFeedbackSlot(proxy->VariableFeedbackSlot()); | |
| 2875 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); | 2893 FrameStateBeforeAndAfter states(this, BeforeId(proxy)); |
| 2876 operand = | 2894 operand = |
| 2877 BuildVariableLoad(proxy->var(), expr->expression()->id(), states, pair, | 2895 BuildVariableLoad(proxy->var(), expr->expression()->id(), states, slot, |
| 2878 OutputFrameStateCombine::Push(), NOT_CONTEXTUAL); | 2896 OutputFrameStateCombine::Push(), NOT_CONTEXTUAL); |
| 2879 } else { | 2897 } else { |
| 2880 VisitForValue(expr->expression()); | 2898 VisitForValue(expr->expression()); |
| 2881 operand = environment()->Pop(); | 2899 operand = environment()->Pop(); |
| 2882 } | 2900 } |
| 2883 Node* value = NewNode(javascript()->TypeOf(), operand); | 2901 Node* value = NewNode(javascript()->TypeOf(), operand); |
| 2884 ast_context()->ProduceValue(value); | 2902 ast_context()->ProduceValue(value); |
| 2885 } | 2903 } |
| 2886 | 2904 |
| 2887 | 2905 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2928 compare_if.End(); | 2946 compare_if.End(); |
| 2929 ast_context()->ReplaceValue(); | 2947 ast_context()->ReplaceValue(); |
| 2930 } | 2948 } |
| 2931 | 2949 |
| 2932 | 2950 |
| 2933 LanguageMode AstGraphBuilder::language_mode() const { | 2951 LanguageMode AstGraphBuilder::language_mode() const { |
| 2934 return info()->language_mode(); | 2952 return info()->language_mode(); |
| 2935 } | 2953 } |
| 2936 | 2954 |
| 2937 | 2955 |
| 2938 VectorSlotPair AstGraphBuilder::CreateVectorSlotPair( | 2956 ResolvedFeedbackSlot AstGraphBuilder::CreateResolvedFeedbackSlot( |
| 2939 FeedbackVectorICSlot slot) const { | 2957 FeedbackVectorICSlot slot) const { |
| 2940 return VectorSlotPair(handle(info()->shared_info()->feedback_vector()), slot); | 2958 return ResolvedFeedbackSlot(handle(info()->shared_info()->feedback_vector()), |
| 2959 slot); | |
| 2941 } | 2960 } |
| 2942 | 2961 |
| 2943 | 2962 |
| 2944 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) { | 2963 uint32_t AstGraphBuilder::ComputeBitsetForDynamicGlobal(Variable* variable) { |
| 2945 DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode()); | 2964 DCHECK_EQ(DYNAMIC_GLOBAL, variable->mode()); |
| 2946 bool found_eval_scope = false; | 2965 bool found_eval_scope = false; |
| 2947 EnumSet<int, uint32_t> check_depths; | 2966 EnumSet<int, uint32_t> check_depths; |
| 2948 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { | 2967 for (Scope* s = current_scope(); s != nullptr; s = s->outer_scope()) { |
| 2949 if (s->num_heap_slots() <= 0) continue; | 2968 if (s->num_heap_slots() <= 0) continue; |
| 2950 // TODO(mstarzinger): If we have reached an eval scope, we check all | 2969 // TODO(mstarzinger): If we have reached an eval scope, we check all |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3164 prototype_check.Else(); | 3183 prototype_check.Else(); |
| 3165 environment()->Push(name); | 3184 environment()->Push(name); |
| 3166 prototype_check.End(); | 3185 prototype_check.End(); |
| 3167 return environment()->Pop(); | 3186 return environment()->Pop(); |
| 3168 } | 3187 } |
| 3169 | 3188 |
| 3170 | 3189 |
| 3171 Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, | 3190 Node* AstGraphBuilder::BuildVariableLoad(Variable* variable, |
| 3172 BailoutId bailout_id, | 3191 BailoutId bailout_id, |
| 3173 FrameStateBeforeAndAfter& states, | 3192 FrameStateBeforeAndAfter& states, |
| 3174 const VectorSlotPair& feedback, | 3193 const ResolvedFeedbackSlot& feedback, |
| 3175 OutputFrameStateCombine combine, | 3194 OutputFrameStateCombine combine, |
| 3176 ContextualMode contextual_mode) { | 3195 ContextualMode contextual_mode) { |
| 3177 Node* the_hole = jsgraph()->TheHoleConstant(); | 3196 Node* the_hole = jsgraph()->TheHoleConstant(); |
| 3178 VariableMode mode = variable->mode(); | 3197 VariableMode mode = variable->mode(); |
| 3179 switch (variable->location()) { | 3198 switch (variable->location()) { |
| 3180 case Variable::UNALLOCATED: { | 3199 case Variable::UNALLOCATED: { |
| 3181 // Global var, const, or let variable. | 3200 // Global var, const, or let variable. |
| 3182 Node* global = BuildLoadGlobalObject(); | 3201 Node* global = BuildLoadGlobalObject(); |
| 3183 Handle<Name> name = variable->name(); | 3202 Handle<Name> name = variable->name(); |
| 3184 Node* value = BuildNamedLoad(global, name, feedback, contextual_mode); | 3203 Node* value = BuildNamedLoad(global, GetFeedbackVector(), name, feedback, |
| 3204 contextual_mode); | |
| 3185 states.AddToNode(value, bailout_id, combine); | 3205 states.AddToNode(value, bailout_id, combine); |
| 3186 return value; | 3206 return value; |
| 3187 } | 3207 } |
| 3188 case Variable::PARAMETER: | 3208 case Variable::PARAMETER: |
| 3189 case Variable::LOCAL: { | 3209 case Variable::LOCAL: { |
| 3190 // Local var, const, or let variable. | 3210 // Local var, const, or let variable. |
| 3191 Node* value = environment()->Lookup(variable); | 3211 Node* value = environment()->Lookup(variable); |
| 3192 if (mode == CONST_LEGACY) { | 3212 if (mode == CONST_LEGACY) { |
| 3193 // Perform check for uninitialized legacy const variables. | 3213 // Perform check for uninitialized legacy const variables. |
| 3194 if (value->op() == the_hole->op()) { | 3214 if (value->op() == the_hole->op()) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3228 return value; | 3248 return value; |
| 3229 } | 3249 } |
| 3230 case Variable::LOOKUP: { | 3250 case Variable::LOOKUP: { |
| 3231 // Dynamic lookup of context variable (anywhere in the chain). | 3251 // Dynamic lookup of context variable (anywhere in the chain). |
| 3232 Node* value = jsgraph()->TheHoleConstant(); | 3252 Node* value = jsgraph()->TheHoleConstant(); |
| 3233 Handle<String> name = variable->name(); | 3253 Handle<String> name = variable->name(); |
| 3234 if (mode == DYNAMIC_GLOBAL) { | 3254 if (mode == DYNAMIC_GLOBAL) { |
| 3235 uint32_t check_bitset = ComputeBitsetForDynamicGlobal(variable); | 3255 uint32_t check_bitset = ComputeBitsetForDynamicGlobal(variable); |
| 3236 const Operator* op = javascript()->LoadDynamicGlobal( | 3256 const Operator* op = javascript()->LoadDynamicGlobal( |
| 3237 name, check_bitset, feedback, contextual_mode); | 3257 name, check_bitset, feedback, contextual_mode); |
| 3238 value = NewNode(op, current_context()); | 3258 value = NewNode(op, GetFeedbackVector(), current_context()); |
| 3239 states.AddToNode(value, bailout_id, combine); | 3259 states.AddToNode(value, bailout_id, combine); |
| 3240 } else if (mode == DYNAMIC_LOCAL) { | 3260 } else if (mode == DYNAMIC_LOCAL) { |
| 3241 Variable* local = variable->local_if_not_shadowed(); | 3261 Variable* local = variable->local_if_not_shadowed(); |
| 3242 DCHECK(local->location() == Variable::CONTEXT); // Must be context. | 3262 DCHECK(local->location() == Variable::CONTEXT); // Must be context. |
| 3243 int depth = current_scope()->ContextChainLength(local->scope()); | 3263 int depth = current_scope()->ContextChainLength(local->scope()); |
| 3244 uint32_t check_bitset = ComputeBitsetForDynamicContext(variable); | 3264 uint32_t check_bitset = ComputeBitsetForDynamicContext(variable); |
| 3245 const Operator* op = javascript()->LoadDynamicContext( | 3265 const Operator* op = javascript()->LoadDynamicContext( |
| 3246 name, check_bitset, depth, local->index()); | 3266 name, check_bitset, depth, local->index()); |
| 3247 value = NewNode(op, current_context()); | 3267 value = NewNode(op, current_context()); |
| 3248 PrepareFrameState(value, bailout_id, combine); | 3268 PrepareFrameState(value, bailout_id, combine); |
| 3249 VariableMode local_mode = local->mode(); | 3269 VariableMode local_mode = local->mode(); |
| 3250 if (local_mode == CONST_LEGACY) { | 3270 if (local_mode == CONST_LEGACY) { |
| 3251 // Perform check for uninitialized legacy const variables. | 3271 // Perform check for uninitialized legacy const variables. |
| 3252 Node* undefined = jsgraph()->UndefinedConstant(); | 3272 Node* undefined = jsgraph()->UndefinedConstant(); |
| 3253 value = BuildHoleCheckSilent(value, undefined, value); | 3273 value = BuildHoleCheckSilent(value, undefined, value); |
| 3254 } else if (local_mode == LET || local_mode == CONST) { | 3274 } else if (local_mode == LET || local_mode == CONST) { |
| 3255 // Perform check for uninitialized let/const variables. | 3275 // Perform check for uninitialized let/const variables. |
| 3256 value = BuildHoleCheckThrow(value, local, value, bailout_id); | 3276 value = BuildHoleCheckThrow(value, local, value, bailout_id); |
| 3257 } | 3277 } |
| 3258 } else if (mode == DYNAMIC) { | 3278 } else if (mode == DYNAMIC) { |
| 3259 uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired; | 3279 uint32_t check_bitset = DynamicGlobalAccess::kFullCheckRequired; |
| 3260 const Operator* op = javascript()->LoadDynamicGlobal( | 3280 const Operator* op = javascript()->LoadDynamicGlobal( |
| 3261 name, check_bitset, feedback, contextual_mode); | 3281 name, check_bitset, feedback, contextual_mode); |
| 3262 value = NewNode(op, current_context()); | 3282 value = NewNode(op, GetFeedbackVector(), current_context()); |
| 3263 states.AddToNode(value, bailout_id, combine); | 3283 states.AddToNode(value, bailout_id, combine); |
| 3264 } | 3284 } |
| 3265 return value; | 3285 return value; |
| 3266 } | 3286 } |
| 3267 } | 3287 } |
| 3268 UNREACHABLE(); | 3288 UNREACHABLE(); |
| 3269 return NULL; | 3289 return NULL; |
| 3270 } | 3290 } |
| 3271 | 3291 |
| 3272 | 3292 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3421 | 3441 |
| 3422 static inline Node* Record(JSTypeFeedbackTable* js_type_feedback, Node* node, | 3442 static inline Node* Record(JSTypeFeedbackTable* js_type_feedback, Node* node, |
| 3423 TypeFeedbackId id) { | 3443 TypeFeedbackId id) { |
| 3424 if (js_type_feedback) { | 3444 if (js_type_feedback) { |
| 3425 js_type_feedback->Record(node, id); | 3445 js_type_feedback->Record(node, id); |
| 3426 } | 3446 } |
| 3427 return node; | 3447 return node; |
| 3428 } | 3448 } |
| 3429 | 3449 |
| 3430 | 3450 |
| 3431 Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key, | 3451 Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key, Node* vector, |
|
Michael Starzinger
2015/06/09 13:23:30
nit: Instead of passing the vector as an argument,
mvstanton
2015/06/09 15:21:26
Ah, good point. Done.
| |
| 3432 const VectorSlotPair& feedback) { | 3452 const ResolvedFeedbackSlot& feedback) { |
| 3433 const Operator* op = javascript()->LoadProperty(feedback); | 3453 const Operator* op = javascript()->LoadProperty(feedback); |
| 3434 return Record(js_type_feedback_, NewNode(op, object, key), feedback.slot()); | 3454 return Record(js_type_feedback_, NewNode(op, object, key, vector), |
| 3455 feedback.slot()); | |
| 3435 } | 3456 } |
| 3436 | 3457 |
| 3437 | 3458 |
| 3438 Node* AstGraphBuilder::BuildNamedLoad(Node* object, Handle<Name> name, | 3459 Node* AstGraphBuilder::BuildNamedLoad(Node* object, Node* vector, |
|
Michael Starzinger
2015/06/09 13:23:30
nit: Likewise.
mvstanton
2015/06/09 15:21:26
Done.
| |
| 3439 const VectorSlotPair& feedback, | 3460 Handle<Name> name, |
| 3461 const ResolvedFeedbackSlot& feedback, | |
| 3440 ContextualMode mode) { | 3462 ContextualMode mode) { |
| 3441 const Operator* op = | 3463 const Operator* op = |
| 3442 javascript()->LoadNamed(MakeUnique(name), feedback, mode); | 3464 javascript()->LoadNamed(MakeUnique(name), feedback, mode); |
| 3443 return Record(js_type_feedback_, NewNode(op, object), feedback.slot()); | 3465 return Record(js_type_feedback_, NewNode(op, object, vector), |
| 3466 feedback.slot()); | |
| 3444 } | 3467 } |
| 3445 | 3468 |
| 3446 | 3469 |
| 3447 Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value, | 3470 Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value, |
| 3448 TypeFeedbackId id) { | 3471 TypeFeedbackId id) { |
| 3449 const Operator* op = javascript()->StoreProperty(language_mode()); | 3472 const Operator* op = javascript()->StoreProperty(language_mode()); |
| 3450 return Record(js_type_feedback_, NewNode(op, object, key, value), id); | 3473 return Record(js_type_feedback_, NewNode(op, object, key, value), id); |
| 3451 } | 3474 } |
| 3452 | 3475 |
| 3453 | 3476 |
| 3454 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, | 3477 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, |
| 3455 Node* value, TypeFeedbackId id) { | 3478 Node* value, TypeFeedbackId id) { |
| 3456 const Operator* op = | 3479 const Operator* op = |
| 3457 javascript()->StoreNamed(language_mode(), MakeUnique(name)); | 3480 javascript()->StoreNamed(language_mode(), MakeUnique(name)); |
| 3458 return Record(js_type_feedback_, NewNode(op, object, value), id); | 3481 return Record(js_type_feedback_, NewNode(op, object, value), id); |
| 3459 } | 3482 } |
| 3460 | 3483 |
| 3461 | 3484 |
| 3462 Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object, | 3485 Node* AstGraphBuilder::BuildNamedSuperLoad( |
| 3463 Handle<Name> name, | 3486 Node* receiver, Node* home_object, Handle<Name> name, |
| 3464 const VectorSlotPair& feedback) { | 3487 const ResolvedFeedbackSlot& feedback) { |
| 3465 Node* name_node = jsgraph()->Constant(name); | 3488 Node* name_node = jsgraph()->Constant(name); |
| 3466 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 3); | 3489 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 3); |
| 3467 Node* value = NewNode(op, receiver, home_object, name_node); | 3490 Node* value = NewNode(op, receiver, home_object, name_node); |
| 3468 return Record(js_type_feedback_, value, feedback.slot()); | 3491 return Record(js_type_feedback_, value, feedback.slot()); |
| 3469 } | 3492 } |
| 3470 | 3493 |
| 3471 | 3494 |
| 3472 Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object, | 3495 Node* AstGraphBuilder::BuildKeyedSuperLoad( |
| 3473 Node* key, | 3496 Node* receiver, Node* home_object, Node* key, |
| 3474 const VectorSlotPair& feedback) { | 3497 const ResolvedFeedbackSlot& feedback) { |
| 3475 const Operator* op = | 3498 const Operator* op = |
| 3476 javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 3499 javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 3477 Node* value = NewNode(op, receiver, home_object, key); | 3500 Node* value = NewNode(op, receiver, home_object, key); |
| 3478 return Record(js_type_feedback_, value, feedback.slot()); | 3501 return Record(js_type_feedback_, value, feedback.slot()); |
| 3479 } | 3502 } |
| 3480 | 3503 |
| 3481 | 3504 |
| 3482 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object, | 3505 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object, |
| 3483 Node* key, Node* value, | 3506 Node* key, Node* value, |
| 3484 TypeFeedbackId id) { | 3507 TypeFeedbackId id) { |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4038 // Phi does not exist yet, introduce one. | 4061 // Phi does not exist yet, introduce one. |
| 4039 value = NewPhi(inputs, value, control); | 4062 value = NewPhi(inputs, value, control); |
| 4040 value->ReplaceInput(inputs - 1, other); | 4063 value->ReplaceInput(inputs - 1, other); |
| 4041 } | 4064 } |
| 4042 return value; | 4065 return value; |
| 4043 } | 4066 } |
| 4044 | 4067 |
| 4045 } // namespace compiler | 4068 } // namespace compiler |
| 4046 } // namespace internal | 4069 } // namespace internal |
| 4047 } // namespace v8 | 4070 } // namespace v8 |
| OLD | NEW |