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

Unified Diff: src/compiler/js-native-context-specialization.cc

Issue 2830633002: [turbofan] Create initial map on-demand for F.prototype. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-native-context-specialization.cc
diff --git a/src/compiler/js-native-context-specialization.cc b/src/compiler/js-native-context-specialization.cc
index 094e3a1166c79e3fee86883a97e42a53eef057e7..ea6120dd6b0f7ecce0a2611dde22da554106f3ab 100644
--- a/src/compiler/js-native-context-specialization.cc
+++ b/src/compiler/js-native-context-specialization.cc
@@ -826,18 +826,16 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) {
p.name().is_identical_to(factory()->prototype_string())) {
// Optimize "prototype" property of functions.
Handle<JSFunction> function = Handle<JSFunction>::cast(m.Value());
- if (function->has_initial_map()) {
- // We need to add a code dependency on the initial map of the
- // {function} in order to be notified about changes to the
- // "prototype" of {function}, so it doesn't make sense to
- // continue unless deoptimization is enabled.
- Handle<Map> initial_map(function->initial_map(), isolate());
- dependencies()->AssumeInitialMapCantChange(initial_map);
- Handle<Object> prototype(function->prototype(), isolate());
- Node* value = jsgraph()->Constant(prototype);
- ReplaceWithValue(node, value);
- return Replace(value);
- }
+ // We need to add a code dependency on the initial map of the
+ // {function} in order to be notified about changes to the
+ // "prototype" of {function}.
+ JSFunction::EnsureHasInitialMap(function);
Michael Starzinger 2017/04/19 10:38:58 The function must be constructible. The following
+ Handle<Map> initial_map(function->initial_map(), isolate());
+ dependencies()->AssumeInitialMapCantChange(initial_map);
+ Handle<Object> prototype(function->prototype(), isolate());
+ Node* value = jsgraph()->Constant(prototype);
+ ReplaceWithValue(node, value);
+ return Replace(value);
} else if (m.Value()->IsString() &&
p.name().is_identical_to(factory()->length_string())) {
// Constant-fold "length" property on constant strings.
« 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