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

Side by Side Diff: src/compiler/js-call-reducer.cc

Issue 2816993002: [turbofan] Use unreliable receiver maps for __proto__ lowering. (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 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-call-reducer.h" 5 #include "src/compiler/js-call-reducer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 // ES6 section B.2.2.1.1 get Object.prototype.__proto__ 330 // ES6 section B.2.2.1.1 get Object.prototype.__proto__
331 Reduction JSCallReducer::ReduceObjectPrototypeGetProto(Node* node) { 331 Reduction JSCallReducer::ReduceObjectPrototypeGetProto(Node* node) {
332 DCHECK_EQ(IrOpcode::kJSCall, node->opcode()); 332 DCHECK_EQ(IrOpcode::kJSCall, node->opcode());
333 Node* receiver = NodeProperties::GetValueInput(node, 1); 333 Node* receiver = NodeProperties::GetValueInput(node, 1);
334 Node* effect = NodeProperties::GetEffectInput(node); 334 Node* effect = NodeProperties::GetEffectInput(node);
335 335
336 // Try to determine the {receiver} map. 336 // Try to determine the {receiver} map.
337 ZoneHandleSet<Map> receiver_maps; 337 ZoneHandleSet<Map> receiver_maps;
338 NodeProperties::InferReceiverMapsResult result = 338 NodeProperties::InferReceiverMapsResult result =
339 NodeProperties::InferReceiverMaps(receiver, effect, &receiver_maps); 339 NodeProperties::InferReceiverMaps(receiver, effect, &receiver_maps);
340 if (result == NodeProperties::kReliableReceiverMaps) { 340 if (result != NodeProperties::kNoReceiverMaps) {
341 Handle<Map> candidate_map( 341 Handle<Map> candidate_map(
342 receiver_maps[0]->GetPrototypeChainRootMap(isolate())); 342 receiver_maps[0]->GetPrototypeChainRootMap(isolate()));
343 Handle<Object> candidate_prototype(candidate_map->prototype(), isolate()); 343 Handle<Object> candidate_prototype(candidate_map->prototype(), isolate());
344 344
345 // Check if we can constant-fold the {candidate_prototype}. 345 // Check if we can constant-fold the {candidate_prototype}.
346 for (size_t i = 0; i < receiver_maps.size(); ++i) { 346 for (size_t i = 0; i < receiver_maps.size(); ++i) {
347 Handle<Map> const receiver_map( 347 Handle<Map> const receiver_map(
348 receiver_maps[i]->GetPrototypeChainRootMap(isolate())); 348 receiver_maps[i]->GetPrototypeChainRootMap(isolate()));
349 if (receiver_map->IsJSProxyMap() || 349 if (receiver_map->IsJSProxyMap() ||
350 receiver_map->has_hidden_prototype() || 350 receiver_map->has_hidden_prototype() ||
351 receiver_map->is_access_check_needed() || 351 receiver_map->is_access_check_needed() ||
352 receiver_map->prototype() != *candidate_prototype) { 352 receiver_map->prototype() != *candidate_prototype) {
353 return NoChange(); 353 return NoChange();
354 } 354 }
355 if (result == NodeProperties::kUnreliableReceiverMaps &&
356 !receiver_map->is_stable()) {
357 return NoChange();
358 }
359 }
360 if (result == NodeProperties::kUnreliableReceiverMaps) {
361 for (size_t i = 0; i < receiver_maps.size(); ++i) {
362 dependencies()->AssumeMapStable(receiver_maps[i]);
363 }
355 } 364 }
356 Node* value = jsgraph()->Constant(candidate_prototype); 365 Node* value = jsgraph()->Constant(candidate_prototype);
357 ReplaceWithValue(node, value); 366 ReplaceWithValue(node, value);
358 return Replace(value); 367 return Replace(value);
359 } 368 }
360 369
361 return NoChange(); 370 return NoChange();
362 } 371 }
363 372
364 Reduction JSCallReducer::ReduceCallApiFunction( 373 Reduction JSCallReducer::ReduceCallApiFunction(
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 return jsgraph()->javascript(); 843 return jsgraph()->javascript();
835 } 844 }
836 845
837 SimplifiedOperatorBuilder* JSCallReducer::simplified() const { 846 SimplifiedOperatorBuilder* JSCallReducer::simplified() const {
838 return jsgraph()->simplified(); 847 return jsgraph()->simplified();
839 } 848 }
840 849
841 } // namespace compiler 850 } // namespace compiler
842 } // namespace internal 851 } // namespace internal
843 } // namespace v8 852 } // 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