OLD | NEW |
---|---|
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 1365 matching lines...) Loading... | |
1376 environment()->Push(proto); | 1376 environment()->Push(proto); |
1377 | 1377 |
1378 // Create nodes to store method values into the literal. | 1378 // Create nodes to store method values into the literal. |
1379 for (int i = 0; i < expr->properties()->length(); i++) { | 1379 for (int i = 0; i < expr->properties()->length(); i++) { |
1380 ObjectLiteral::Property* property = expr->properties()->at(i); | 1380 ObjectLiteral::Property* property = expr->properties()->at(i); |
1381 environment()->Push(property->is_static() ? literal : proto); | 1381 environment()->Push(property->is_static() ? literal : proto); |
1382 | 1382 |
1383 VisitForValue(property->key()); | 1383 VisitForValue(property->key()); |
1384 environment()->Push( | 1384 environment()->Push( |
1385 BuildToName(environment()->Pop(), expr->GetIdForProperty(i))); | 1385 BuildToName(environment()->Pop(), expr->GetIdForProperty(i))); |
1386 | |
1387 // The static prototype property is read only. We handle the non computed | |
1388 // property name case in the parser. Since this is the only case where we | |
1389 // need to check for an own read only property we special case this so we do | |
1390 // not need to do this for every property. | |
1391 if (property->is_static() && property->is_computed_name()) { | |
1392 Node* name = environment()->Pop(); | |
1393 const Operator* op = | |
1394 javascript()->CallRuntime(Runtime::kThrowIfStaticPrototype, 1); | |
arv (Not doing code reviews)
2015/03/06 11:51:29
I'm tempted to do the `if (name === 'prototype') {
Michael Starzinger
2015/03/06 13:05:18
I would be fine with having the comparison inline
Dmitry Lomov (no reviews)
2015/03/09 14:46:04
I think inline comparison is better overall since
| |
1395 Node* maybe_throw = NewNode(op, name); | |
1396 PrepareFrameState(maybe_throw, expr->GetIdForProperty(i)); | |
1397 environment()->Push(maybe_throw); | |
1398 } | |
1399 | |
1386 VisitForValue(property->value()); | 1400 VisitForValue(property->value()); |
1387 Node* value = environment()->Pop(); | 1401 Node* value = environment()->Pop(); |
1388 Node* key = environment()->Pop(); | 1402 Node* key = environment()->Pop(); |
1389 Node* receiver = environment()->Pop(); | 1403 Node* receiver = environment()->Pop(); |
1390 BuildSetHomeObject(value, receiver, property->value()); | 1404 BuildSetHomeObject(value, receiver, property->value()); |
1391 | 1405 |
1392 switch (property->kind()) { | 1406 switch (property->kind()) { |
1393 case ObjectLiteral::Property::CONSTANT: | 1407 case ObjectLiteral::Property::CONSTANT: |
1394 case ObjectLiteral::Property::MATERIALIZED_LITERAL: | 1408 case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
1395 case ObjectLiteral::Property::PROTOTYPE: | 1409 case ObjectLiteral::Property::PROTOTYPE: |
(...skipping 1862 matching lines...) Loading... | |
3258 // Phi does not exist yet, introduce one. | 3272 // Phi does not exist yet, introduce one. |
3259 value = NewPhi(inputs, value, control); | 3273 value = NewPhi(inputs, value, control); |
3260 value->ReplaceInput(inputs - 1, other); | 3274 value->ReplaceInput(inputs - 1, other); |
3261 } | 3275 } |
3262 return value; | 3276 return value; |
3263 } | 3277 } |
3264 | 3278 |
3265 } // namespace compiler | 3279 } // namespace compiler |
3266 } // namespace internal | 3280 } // namespace internal |
3267 } // namespace v8 | 3281 } // namespace v8 |
OLD | NEW |