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/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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 builder()->LoadLiteral(value); | 1035 builder()->LoadLiteral(value); |
1036 } | 1036 } |
1037 execution_result()->SetResultInAccumulator(); | 1037 execution_result()->SetResultInAccumulator(); |
1038 } | 1038 } |
1039 } | 1039 } |
1040 | 1040 |
1041 | 1041 |
1042 void BytecodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1042 void BytecodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
1043 // Materialize a regular expression literal. | 1043 // Materialize a regular expression literal. |
1044 TemporaryRegisterScope temporary_register_scope(builder()); | 1044 TemporaryRegisterScope temporary_register_scope(builder()); |
1045 Register flags = temporary_register_scope.NewRegister(); | |
1046 builder() | 1045 builder() |
1047 ->LoadLiteral(expr->flags()) | 1046 ->LoadLiteral(expr->pattern()) |
1048 .StoreAccumulatorInRegister(flags) | 1047 .CreateRegExpLiteral(expr->literal_index(), expr->flags()); |
1049 .LoadLiteral(expr->pattern()) | |
1050 .CreateRegExpLiteral(expr->literal_index(), flags); | |
1051 execution_result()->SetResultInAccumulator(); | 1048 execution_result()->SetResultInAccumulator(); |
1052 } | 1049 } |
1053 | 1050 |
1054 | 1051 |
1055 void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1052 void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1056 // Deep-copy the literal boilerplate. | 1053 // Deep-copy the literal boilerplate. |
1057 builder() | 1054 builder() |
1058 ->LoadLiteral(expr->constant_properties()) | 1055 ->LoadLiteral(expr->constant_properties()) |
1059 .CreateObjectLiteral(expr->literal_index(), expr->ComputeFlags(true)); | 1056 .CreateObjectLiteral(expr->literal_index(), expr->ComputeFlags(true)); |
1060 | 1057 |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2230 } | 2227 } |
2231 | 2228 |
2232 | 2229 |
2233 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 2230 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
2234 return info()->feedback_vector()->GetIndex(slot); | 2231 return info()->feedback_vector()->GetIndex(slot); |
2235 } | 2232 } |
2236 | 2233 |
2237 } // namespace interpreter | 2234 } // namespace interpreter |
2238 } // namespace internal | 2235 } // namespace internal |
2239 } // namespace v8 | 2236 } // namespace v8 |
OLD | NEW |