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 "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/interpreter/bytecode-register-allocator.h" | 10 #include "src/interpreter/bytecode-register-allocator.h" |
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 builder()->Bind(&end_label); | 1507 builder()->Bind(&end_label); |
1508 | 1508 |
1509 execution_result()->SetResultInAccumulator(); | 1509 execution_result()->SetResultInAccumulator(); |
1510 } | 1510 } |
1511 | 1511 |
1512 void BytecodeGenerator::VisitLiteral(Literal* expr) { | 1512 void BytecodeGenerator::VisitLiteral(Literal* expr) { |
1513 if (!execution_result()->IsEffect()) { | 1513 if (!execution_result()->IsEffect()) { |
1514 Handle<Object> value = expr->value(); | 1514 Handle<Object> value = expr->value(); |
1515 if (value->IsSmi()) { | 1515 if (value->IsSmi()) { |
1516 builder()->LoadLiteral(Smi::cast(*value)); | 1516 builder()->LoadLiteral(Smi::cast(*value)); |
1517 } else if (value->IsUndefined()) { | 1517 } else if (value->IsUndefined(isolate())) { |
1518 builder()->LoadUndefined(); | 1518 builder()->LoadUndefined(); |
1519 } else if (value->IsTrue()) { | 1519 } else if (value->IsTrue()) { |
1520 builder()->LoadTrue(); | 1520 builder()->LoadTrue(); |
1521 } else if (value->IsFalse()) { | 1521 } else if (value->IsFalse()) { |
1522 builder()->LoadFalse(); | 1522 builder()->LoadFalse(); |
1523 } else if (value->IsNull()) { | 1523 } else if (value->IsNull()) { |
1524 builder()->LoadNull(); | 1524 builder()->LoadNull(); |
1525 } else if (value->IsTheHole()) { | 1525 } else if (value->IsTheHole(isolate())) { |
1526 builder()->LoadTheHole(); | 1526 builder()->LoadTheHole(); |
1527 } else { | 1527 } else { |
1528 builder()->LoadLiteral(value); | 1528 builder()->LoadLiteral(value); |
1529 } | 1529 } |
1530 execution_result()->SetResultInAccumulator(); | 1530 execution_result()->SetResultInAccumulator(); |
1531 } | 1531 } |
1532 } | 1532 } |
1533 | 1533 |
1534 void BytecodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1534 void BytecodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
1535 // Materialize a regular expression literal. | 1535 // Materialize a regular expression literal. |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3196 return execution_context()->scope()->language_mode(); | 3196 return execution_context()->scope()->language_mode(); |
3197 } | 3197 } |
3198 | 3198 |
3199 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3199 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
3200 return TypeFeedbackVector::GetIndex(slot); | 3200 return TypeFeedbackVector::GetIndex(slot); |
3201 } | 3201 } |
3202 | 3202 |
3203 } // namespace interpreter | 3203 } // namespace interpreter |
3204 } // namespace internal | 3204 } // namespace internal |
3205 } // namespace v8 | 3205 } // namespace v8 |
OLD | NEW |