Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: src/compiler/js-intrinsic-lowering.cc

Issue 2409423006: [turbofan] Enable super constructor inlining. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/js-intrinsic-lowering.h" 5 #include "src/compiler/js-intrinsic-lowering.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 ConvertReceiverMode::kAny, 307 ConvertReceiverMode::kAny,
308 TailCallMode::kDisallow)); 308 TailCallMode::kDisallow));
309 return Changed(node); 309 return Changed(node);
310 } 310 }
311 311
312 Reduction JSIntrinsicLowering::ReduceNewObject(Node* node) { 312 Reduction JSIntrinsicLowering::ReduceNewObject(Node* node) {
313 return Change(node, CodeFactory::FastNewObject(isolate()), 0); 313 return Change(node, CodeFactory::FastNewObject(isolate()), 0);
314 } 314 }
315 315
316 Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) { 316 Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) {
317 Node* active_function = NodeProperties::GetValueInput(node, 0); 317 Node* target = NodeProperties::GetValueInput(node, 0);
318 Node* effect = NodeProperties::GetEffectInput(node); 318 // The prototype of subclass constructors is non-writable, non-configurable
319 Node* control = NodeProperties::GetControlInput(node); 319 // in ES6, so we don't need to do any checking, but we can just load (or even
320 Node* active_function_map = effect = 320 // constant-fold) the prototype from the {target}.
321 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), 321 HeapObjectMatcher m(target);
322 active_function, effect, control); 322 if (m.HasValue()) {
323 return Change(node, simplified()->LoadField(AccessBuilder::ForMapPrototype()), 323 Handle<JSFunction> target_function = Handle<JSFunction>::cast(m.Value());
324 active_function_map, effect, control); 324 Node* value = jsgraph()->HeapConstant(handle(
325 JSFunction::cast(target_function->map()->prototype()), isolate()));
326 ReplaceWithValue(node, value);
327 return Replace(value);
328 } else {
329 Node* effect = NodeProperties::GetEffectInput(node);
330 Node* control = NodeProperties::GetControlInput(node);
331 Node* target_map = effect =
332 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
333 target, effect, control);
334 return Change(node,
335 simplified()->LoadField(AccessBuilder::ForMapPrototype()),
336 target_map, effect, control);
337 }
325 } 338 }
326 339
327 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a, 340 Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
328 Node* b) { 341 Node* b) {
329 RelaxControls(node); 342 RelaxControls(node);
330 node->ReplaceInput(0, a); 343 node->ReplaceInput(0, a);
331 node->ReplaceInput(1, b); 344 node->ReplaceInput(1, b);
332 node->TrimInputCount(2); 345 node->TrimInputCount(2);
333 NodeProperties::ChangeOp(node, op); 346 NodeProperties::ChangeOp(node, op);
334 return Changed(node); 347 return Changed(node);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 return jsgraph_->javascript(); 399 return jsgraph_->javascript();
387 } 400 }
388 401
389 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const { 402 SimplifiedOperatorBuilder* JSIntrinsicLowering::simplified() const {
390 return jsgraph()->simplified(); 403 return jsgraph()->simplified();
391 } 404 }
392 405
393 } // namespace compiler 406 } // namespace compiler
394 } // namespace internal 407 } // namespace internal
395 } // namespace v8 408 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698