| OLD | NEW |
| 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 <stack> | 7 #include <stack> |
| 8 | 8 |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/objects.h" | 10 #include "src/objects.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 333 |
| 334 // Evaluate the value and potentially handle compound assignments by loading | 334 // Evaluate the value and potentially handle compound assignments by loading |
| 335 // the left-hand side value and performing a binary operation. | 335 // the left-hand side value and performing a binary operation. |
| 336 if (expr->is_compound()) { | 336 if (expr->is_compound()) { |
| 337 UNIMPLEMENTED(); | 337 UNIMPLEMENTED(); |
| 338 } else { | 338 } else { |
| 339 Visit(expr->value()); | 339 Visit(expr->value()); |
| 340 } | 340 } |
| 341 | 341 |
| 342 // Store the value. | 342 // Store the value. |
| 343 FeedbackVectorICSlot slot = expr->AssignmentSlot(); | 343 FeedbackVectorSlot slot = expr->AssignmentSlot(); |
| 344 switch (assign_type) { | 344 switch (assign_type) { |
| 345 case VARIABLE: { | 345 case VARIABLE: { |
| 346 Variable* variable = expr->target()->AsVariableProxy()->var(); | 346 Variable* variable = expr->target()->AsVariableProxy()->var(); |
| 347 DCHECK(variable->location() == VariableLocation::LOCAL); | 347 DCHECK(variable->location() == VariableLocation::LOCAL); |
| 348 Register destination(variable->index()); | 348 Register destination(variable->index()); |
| 349 builder().StoreAccumulatorInRegister(destination); | 349 builder().StoreAccumulatorInRegister(destination); |
| 350 break; | 350 break; |
| 351 } | 351 } |
| 352 case NAMED_PROPERTY: | 352 case NAMED_PROPERTY: |
| 353 builder().StoreNamedProperty(object, key, feedback_index(slot), | 353 builder().StoreNamedProperty(object, key, feedback_index(slot), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 365 | 365 |
| 366 | 366 |
| 367 void BytecodeGenerator::VisitYield(Yield* expr) { UNIMPLEMENTED(); } | 367 void BytecodeGenerator::VisitYield(Yield* expr) { UNIMPLEMENTED(); } |
| 368 | 368 |
| 369 | 369 |
| 370 void BytecodeGenerator::VisitThrow(Throw* expr) { UNIMPLEMENTED(); } | 370 void BytecodeGenerator::VisitThrow(Throw* expr) { UNIMPLEMENTED(); } |
| 371 | 371 |
| 372 | 372 |
| 373 void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) { | 373 void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) { |
| 374 LhsKind property_kind = Property::GetAssignType(expr); | 374 LhsKind property_kind = Property::GetAssignType(expr); |
| 375 FeedbackVectorICSlot slot = expr->PropertyFeedbackSlot(); | 375 FeedbackVectorSlot slot = expr->PropertyFeedbackSlot(); |
| 376 switch (property_kind) { | 376 switch (property_kind) { |
| 377 case VARIABLE: | 377 case VARIABLE: |
| 378 UNREACHABLE(); | 378 UNREACHABLE(); |
| 379 case NAMED_PROPERTY: { | 379 case NAMED_PROPERTY: { |
| 380 builder().LoadLiteral(expr->key()->AsLiteral()->AsPropertyName()); | 380 builder().LoadLiteral(expr->key()->AsLiteral()->AsPropertyName()); |
| 381 builder().LoadNamedProperty(obj, feedback_index(slot), language_mode()); | 381 builder().LoadNamedProperty(obj, feedback_index(slot), language_mode()); |
| 382 break; | 382 break; |
| 383 } | 383 } |
| 384 case KEYED_PROPERTY: { | 384 case KEYED_PROPERTY: { |
| 385 Visit(expr->key()); | 385 Visit(expr->key()); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 Visit(right); | 539 Visit(right); |
| 540 builder().BinaryOperation(op, temporary); | 540 builder().BinaryOperation(op, temporary); |
| 541 } | 541 } |
| 542 | 542 |
| 543 | 543 |
| 544 LanguageMode BytecodeGenerator::language_mode() const { | 544 LanguageMode BytecodeGenerator::language_mode() const { |
| 545 return info()->language_mode(); | 545 return info()->language_mode(); |
| 546 } | 546 } |
| 547 | 547 |
| 548 | 548 |
| 549 int BytecodeGenerator::feedback_index(FeedbackVectorICSlot slot) const { | 549 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 550 return info()->feedback_vector()->GetIndex(slot); | 550 return info()->feedback_vector()->GetIndex(slot); |
| 551 } | 551 } |
| 552 | 552 |
| 553 } // namespace interpreter | 553 } // namespace interpreter |
| 554 } // namespace internal | 554 } // namespace internal |
| 555 } // namespace v8 | 555 } // namespace v8 |
| OLD | NEW |