| 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/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/compilation-info.h" | 10 #include "src/compilation-info.h" |
| (...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 literal_argument, 4); | 1869 literal_argument, 4); |
| 1870 break; | 1870 break; |
| 1871 } | 1871 } |
| 1872 } | 1872 } |
| 1873 | 1873 |
| 1874 execution_result()->SetResultInRegister(literal); | 1874 execution_result()->SetResultInRegister(literal); |
| 1875 } | 1875 } |
| 1876 | 1876 |
| 1877 void BytecodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { | 1877 void BytecodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { |
| 1878 // Deep-copy the literal boilerplate. | 1878 // Deep-copy the literal boilerplate. |
| 1879 int runtime_flags = expr->ComputeFlags(); |
| 1880 bool must_use_runtime = |
| 1881 (runtime_flags & ArrayLiteral::kShallowElements) == 0 || |
| 1882 expr->values()->length() > JSArray::kInitialMaxFastElementArray; |
| 1883 uint8_t flags = |
| 1884 CreateArrayLiteralFlags::Encode(must_use_runtime, runtime_flags); |
| 1879 builder()->CreateArrayLiteral(expr->constant_elements(), | 1885 builder()->CreateArrayLiteral(expr->constant_elements(), |
| 1880 expr->literal_index(), expr->ComputeFlags()); | 1886 expr->literal_index(), flags); |
| 1881 Register index, literal; | 1887 Register index, literal; |
| 1882 | 1888 |
| 1883 // Evaluate all the non-constant subexpressions and store them into the | 1889 // Evaluate all the non-constant subexpressions and store them into the |
| 1884 // newly cloned array. | 1890 // newly cloned array. |
| 1885 bool literal_in_accumulator = true; | 1891 bool literal_in_accumulator = true; |
| 1886 for (int array_index = 0; array_index < expr->values()->length(); | 1892 for (int array_index = 0; array_index < expr->values()->length(); |
| 1887 array_index++) { | 1893 array_index++) { |
| 1888 Expression* subexpr = expr->values()->at(array_index); | 1894 Expression* subexpr = expr->values()->at(array_index); |
| 1889 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; | 1895 if (CompileTimeValue::IsCompileTimeValue(subexpr)) continue; |
| 1890 DCHECK(!subexpr->IsSpread()); | 1896 DCHECK(!subexpr->IsSpread()); |
| (...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3453 return execution_context()->scope()->language_mode(); | 3459 return execution_context()->scope()->language_mode(); |
| 3454 } | 3460 } |
| 3455 | 3461 |
| 3456 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { | 3462 int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const { |
| 3457 return TypeFeedbackVector::GetIndex(slot); | 3463 return TypeFeedbackVector::GetIndex(slot); |
| 3458 } | 3464 } |
| 3459 | 3465 |
| 3460 } // namespace interpreter | 3466 } // namespace interpreter |
| 3461 } // namespace internal | 3467 } // namespace internal |
| 3462 } // namespace v8 | 3468 } // namespace v8 |
| OLD | NEW |