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

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

Issue 896643003: Class methods should be non enumerable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: formatting Created 5 years, 10 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/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1332 case ObjectLiteral::Property::MATERIALIZED_LITERAL: 1332 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1333 case ObjectLiteral::Property::PROTOTYPE: 1333 case ObjectLiteral::Property::PROTOTYPE:
1334 UNREACHABLE(); 1334 UNREACHABLE();
1335 case ObjectLiteral::Property::COMPUTED: { 1335 case ObjectLiteral::Property::COMPUTED: {
1336 const Operator* op = 1336 const Operator* op =
1337 javascript()->CallRuntime(Runtime::kDefineClassMethod, 3); 1337 javascript()->CallRuntime(Runtime::kDefineClassMethod, 3);
1338 NewNode(op, receiver, key, value); 1338 NewNode(op, receiver, key, value);
1339 break; 1339 break;
1340 } 1340 }
1341 case ObjectLiteral::Property::GETTER: { 1341 case ObjectLiteral::Property::GETTER: {
1342 Node* attr = jsgraph()->Constant(DONT_ENUM);
1342 const Operator* op = javascript()->CallRuntime( 1343 const Operator* op = javascript()->CallRuntime(
1343 Runtime::kDefineGetterPropertyUnchecked, 3); 1344 Runtime::kDefineGetterPropertyUnchecked, 4);
1344 NewNode(op, receiver, key, value); 1345 NewNode(op, receiver, key, value, attr);
1345 break; 1346 break;
1346 } 1347 }
1347 case ObjectLiteral::Property::SETTER: { 1348 case ObjectLiteral::Property::SETTER: {
1349 Node* attr = jsgraph()->Constant(DONT_ENUM);
1348 const Operator* op = javascript()->CallRuntime( 1350 const Operator* op = javascript()->CallRuntime(
1349 Runtime::kDefineSetterPropertyUnchecked, 3); 1351 Runtime::kDefineSetterPropertyUnchecked, 4);
1350 NewNode(op, receiver, key, value); 1352 NewNode(op, receiver, key, value, attr);
1351 break; 1353 break;
1352 } 1354 }
1353 } 1355 }
1354 1356
1355 // TODO(mstarzinger): This is temporary to make "super" work and replicates 1357 // TODO(mstarzinger): This is temporary to make "super" work and replicates
1356 // the existing FullCodeGenerator::NeedsHomeObject predicate. 1358 // the existing FullCodeGenerator::NeedsHomeObject predicate.
1357 if (FunctionLiteral::NeedsHomeObject(property->value())) { 1359 if (FunctionLiteral::NeedsHomeObject(property->value())) {
1358 Unique<Name> name = 1360 Unique<Name> name =
1359 MakeUnique(isolate()->factory()->home_object_symbol()); 1361 MakeUnique(isolate()->factory()->home_object_symbol());
1360 Node* store = NewNode(javascript()->StoreNamed(strict_mode(), name), 1362 Node* store = NewNode(javascript()->StoreNamed(strict_mode(), name),
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 break; 1577 break;
1576 } 1578 }
1577 case ObjectLiteral::Property::PROTOTYPE: { 1579 case ObjectLiteral::Property::PROTOTYPE: {
1578 const Operator* op = 1580 const Operator* op =
1579 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2); 1581 javascript()->CallRuntime(Runtime::kInternalSetPrototype, 2);
1580 Node* call = NewNode(op, receiver, value); 1582 Node* call = NewNode(op, receiver, value);
1581 PrepareFrameState(call, BailoutId::None()); 1583 PrepareFrameState(call, BailoutId::None());
1582 break; 1584 break;
1583 } 1585 }
1584 case ObjectLiteral::Property::GETTER: { 1586 case ObjectLiteral::Property::GETTER: {
1587 Node* attr = jsgraph()->Constant(NONE);
1585 const Operator* op = javascript()->CallRuntime( 1588 const Operator* op = javascript()->CallRuntime(
1586 Runtime::kDefineGetterPropertyUnchecked, 3); 1589 Runtime::kDefineGetterPropertyUnchecked, 4);
1587 Node* call = NewNode(op, receiver, key, value); 1590 Node* call = NewNode(op, receiver, key, value, attr);
1588 PrepareFrameState(call, BailoutId::None()); 1591 PrepareFrameState(call, BailoutId::None());
1589 break; 1592 break;
1590 } 1593 }
1591 case ObjectLiteral::Property::SETTER: { 1594 case ObjectLiteral::Property::SETTER: {
1595 Node* attr = jsgraph()->Constant(NONE);
1592 const Operator* op = javascript()->CallRuntime( 1596 const Operator* op = javascript()->CallRuntime(
1593 Runtime::kDefineSetterPropertyUnchecked, 3); 1597 Runtime::kDefineSetterPropertyUnchecked, 4);
1594 Node* call = NewNode(op, receiver, key, value); 1598 Node* call = NewNode(op, receiver, key, value, attr);
1595 PrepareFrameState(call, BailoutId::None()); 1599 PrepareFrameState(call, BailoutId::None());
1596 break; 1600 break;
1597 } 1601 }
1598 } 1602 }
1599 } 1603 }
1600 1604
1601 // Transform literals that contain functions to fast properties. 1605 // Transform literals that contain functions to fast properties.
1602 if (expr->has_function()) { 1606 if (expr->has_function()) {
1603 const Operator* op = 1607 const Operator* op =
1604 javascript()->CallRuntime(Runtime::kToFastProperties, 1); 1608 javascript()->CallRuntime(Runtime::kToFastProperties, 1);
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after
3120 Node* dead_node = graph()->NewNode(common()->Dead()); 3124 Node* dead_node = graph()->NewNode(common()->Dead());
3121 dead_control_.set(dead_node); 3125 dead_control_.set(dead_node);
3122 return dead_node; 3126 return dead_node;
3123 } 3127 }
3124 return dead_control_.get(); 3128 return dead_control_.get();
3125 } 3129 }
3126 3130
3127 } // namespace compiler 3131 } // namespace compiler
3128 } // namespace internal 3132 } // namespace internal
3129 } // namespace v8 3133 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698