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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix arm64 port Created 5 years, 6 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
OLDNEW
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 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after
3424 TypeFeedbackId id) { 3424 TypeFeedbackId id) {
3425 if (js_type_feedback) { 3425 if (js_type_feedback) {
3426 js_type_feedback->Record(node, id); 3426 js_type_feedback->Record(node, id);
3427 } 3427 }
3428 return node; 3428 return node;
3429 } 3429 }
3430 3430
3431 3431
3432 Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key, 3432 Node* AstGraphBuilder::BuildKeyedLoad(Node* object, Node* key,
3433 const VectorSlotPair& feedback) { 3433 const VectorSlotPair& feedback) {
3434 const Operator* op = javascript()->LoadProperty(feedback); 3434 const Operator* op = javascript()->LoadProperty(feedback, language_mode());
3435 return Record(js_type_feedback_, NewNode(op, object, key), feedback.slot()); 3435 return Record(js_type_feedback_, NewNode(op, object, key), feedback.slot());
3436 } 3436 }
3437 3437
3438 3438
3439 Node* AstGraphBuilder::BuildNamedLoad(Node* object, Handle<Name> name, 3439 Node* AstGraphBuilder::BuildNamedLoad(Node* object, Handle<Name> name,
3440 const VectorSlotPair& feedback, 3440 const VectorSlotPair& feedback,
3441 ContextualMode mode) { 3441 ContextualMode mode) {
3442 const Operator* op = 3442 const Operator* op = javascript()->LoadNamed(MakeUnique(name), feedback,
3443 javascript()->LoadNamed(MakeUnique(name), feedback, mode); 3443 language_mode(), mode);
3444 return Record(js_type_feedback_, NewNode(op, object), feedback.slot()); 3444 return Record(js_type_feedback_, NewNode(op, object), feedback.slot());
3445 } 3445 }
3446 3446
3447 3447
3448 Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value, 3448 Node* AstGraphBuilder::BuildKeyedStore(Node* object, Node* key, Node* value,
3449 TypeFeedbackId id) { 3449 TypeFeedbackId id) {
3450 const Operator* op = javascript()->StoreProperty(language_mode()); 3450 const Operator* op = javascript()->StoreProperty(language_mode());
3451 return Record(js_type_feedback_, NewNode(op, object, key, value), id); 3451 return Record(js_type_feedback_, NewNode(op, object, key, value), id);
3452 } 3452 }
3453 3453
3454 3454
3455 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name, 3455 Node* AstGraphBuilder::BuildNamedStore(Node* object, Handle<Name> name,
3456 Node* value, TypeFeedbackId id) { 3456 Node* value, TypeFeedbackId id) {
3457 const Operator* op = 3457 const Operator* op =
3458 javascript()->StoreNamed(language_mode(), MakeUnique(name)); 3458 javascript()->StoreNamed(language_mode(), MakeUnique(name));
3459 return Record(js_type_feedback_, NewNode(op, object, value), id); 3459 return Record(js_type_feedback_, NewNode(op, object, value), id);
3460 } 3460 }
3461 3461
3462 3462
3463 Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object, 3463 Node* AstGraphBuilder::BuildNamedSuperLoad(Node* receiver, Node* home_object,
3464 Handle<Name> name, 3464 Handle<Name> name,
3465 const VectorSlotPair& feedback) { 3465 const VectorSlotPair& feedback) {
3466 Node* name_node = jsgraph()->Constant(name); 3466 Node* name_node = jsgraph()->Constant(name);
3467 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 3); 3467 Node* language = jsgraph()->Constant(language_mode());
3468 Node* value = NewNode(op, receiver, home_object, name_node); 3468 const Operator* op = javascript()->CallRuntime(Runtime::kLoadFromSuper, 4);
3469 Node* value = NewNode(op, receiver, home_object, name_node, language);
3469 return Record(js_type_feedback_, value, feedback.slot()); 3470 return Record(js_type_feedback_, value, feedback.slot());
3470 } 3471 }
3471 3472
3472 3473
3473 Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object, 3474 Node* AstGraphBuilder::BuildKeyedSuperLoad(Node* receiver, Node* home_object,
3474 Node* key, 3475 Node* key,
3475 const VectorSlotPair& feedback) { 3476 const VectorSlotPair& feedback) {
3477 Node* language = jsgraph()->Constant(language_mode());
3476 const Operator* op = 3478 const Operator* op =
3477 javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 3479 javascript()->CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
3478 Node* value = NewNode(op, receiver, home_object, key); 3480 Node* value = NewNode(op, receiver, home_object, key, language);
3479 return Record(js_type_feedback_, value, feedback.slot()); 3481 return Record(js_type_feedback_, value, feedback.slot());
3480 } 3482 }
3481 3483
3482 3484
3483 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object, 3485 Node* AstGraphBuilder::BuildKeyedSuperStore(Node* receiver, Node* home_object,
3484 Node* key, Node* value, 3486 Node* key, Node* value,
3485 TypeFeedbackId id) { 3487 TypeFeedbackId id) {
3486 Runtime::FunctionId function_id = is_strict(language_mode()) 3488 Runtime::FunctionId function_id = is_strict(language_mode())
3487 ? Runtime::kStoreKeyedToSuper_Strict 3489 ? Runtime::kStoreKeyedToSuper_Strict
3488 : Runtime::kStoreKeyedToSuper_Sloppy; 3490 : Runtime::kStoreKeyedToSuper_Sloppy;
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
4039 // Phi does not exist yet, introduce one. 4041 // Phi does not exist yet, introduce one.
4040 value = NewPhi(inputs, value, control); 4042 value = NewPhi(inputs, value, control);
4041 value->ReplaceInput(inputs - 1, other); 4043 value->ReplaceInput(inputs - 1, other);
4042 } 4044 }
4043 return value; 4045 return value;
4044 } 4046 }
4045 4047
4046 } // namespace compiler 4048 } // namespace compiler
4047 } // namespace internal 4049 } // namespace internal
4048 } // namespace v8 4050 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698