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