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

Side by Side Diff: src/interpreter/bytecode-generator.cc

Issue 1309813007: [es6] implement destructuring assignment (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Cache te right scope in DeclareAndInitializeVariables() Created 5 years 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 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/interpreter/bytecode-generator.h" 5 #include "src/interpreter/bytecode-generator.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/interpreter/control-flow-builders.h" 8 #include "src/interpreter/control-flow-builders.h"
9 #include "src/objects.h" 9 #include "src/objects.h"
10 #include "src/parser.h" 10 #include "src/parser.h"
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 builder()->StoreContextSlot(context_reg, variable->index()); 1423 builder()->StoreContextSlot(context_reg, variable->index());
1424 break; 1424 break;
1425 } 1425 }
1426 case VariableLocation::LOOKUP: 1426 case VariableLocation::LOOKUP:
1427 UNIMPLEMENTED(); 1427 UNIMPLEMENTED();
1428 } 1428 }
1429 } 1429 }
1430 1430
1431 1431
1432 void BytecodeGenerator::VisitAssignment(Assignment* expr) { 1432 void BytecodeGenerator::VisitAssignment(Assignment* expr) {
1433 RETURN_IF_VISIT_NODE(expr->destructuring_assignment());
1434
1433 DCHECK(expr->target()->IsValidReferenceExpression()); 1435 DCHECK(expr->target()->IsValidReferenceExpression());
1434 Register object, key; 1436 Register object, key;
1435 size_t name_index = kMaxUInt32; 1437 size_t name_index = kMaxUInt32;
1436 1438
1437 // Left-hand side can only be a property, a global or a variable slot. 1439 // Left-hand side can only be a property, a global or a variable slot.
1438 Property* property = expr->target()->AsProperty(); 1440 Property* property = expr->target()->AsProperty();
1439 LhsKind assign_type = Property::GetAssignType(property); 1441 LhsKind assign_type = Property::GetAssignType(property);
1440 1442
1441 // Evaluate LHS expression. 1443 // Evaluate LHS expression.
1442 switch (assign_type) { 1444 switch (assign_type) {
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 } 2232 }
2231 2233
2232 2234
2233 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { 2235 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
2234 return info()->feedback_vector()->GetIndex(slot); 2236 return info()->feedback_vector()->GetIndex(slot);
2235 } 2237 }
2236 2238
2237 } // namespace interpreter 2239 } // namespace interpreter
2238 } // namespace internal 2240 } // namespace internal
2239 } // namespace v8 2241 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698