| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 // Required to get M_E etc. in MSVC. | 7 // Required to get M_E etc. in MSVC. |
| 8 #if defined(_WIN32) | 8 #if defined(_WIN32) |
| 9 #define _USE_MATH_DEFINES | 9 #define _USE_MATH_DEFINES |
| 10 #endif | 10 #endif |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 DCHECK_EQ(kModuleScope, scope_); | 115 DCHECK_EQ(kModuleScope, scope_); |
| 116 DCHECK_NULL(current_function_builder_); | 116 DCHECK_NULL(current_function_builder_); |
| 117 current_function_builder_ = LookupOrInsertFunction(decl->proxy()->var()); | 117 current_function_builder_ = LookupOrInsertFunction(decl->proxy()->var()); |
| 118 scope_ = kFuncScope; | 118 scope_ = kFuncScope; |
| 119 RECURSE(Visit(decl->fun())); | 119 RECURSE(Visit(decl->fun())); |
| 120 scope_ = kModuleScope; | 120 scope_ = kModuleScope; |
| 121 current_function_builder_ = nullptr; | 121 current_function_builder_ = nullptr; |
| 122 local_variables_.Clear(); | 122 local_variables_.Clear(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void VisitStatements(ZoneList<Statement*>* stmts) { | 125 void VisitStatements(ZoneChunkList<Statement*>* statements) { |
| 126 for (int i = 0; i < stmts->length(); ++i) { | 126 for (Statement* statement : *statements) { |
| 127 Statement* stmt = stmts->at(i); | 127 ExpressionStatement* e = statement->AsExpressionStatement(); |
| 128 ExpressionStatement* e = stmt->AsExpressionStatement(); | |
| 129 if (e != nullptr && e->expression()->IsUndefinedLiteral()) { | 128 if (e != nullptr && e->expression()->IsUndefinedLiteral()) { |
| 130 continue; | 129 continue; |
| 131 } | 130 } |
| 132 RECURSE(Visit(stmt)); | 131 RECURSE(Visit(statement)); |
| 133 if (stmt->IsJump()) break; | 132 if (statement->IsJump()) break; |
| 134 } | 133 } |
| 135 } | 134 } |
| 136 | 135 |
| 137 void VisitBlock(Block* stmt) { | 136 void VisitBlock(Block* stmt) { |
| 138 if (stmt->statements()->length() == 1) { | 137 if (stmt->statements()->size() == 1) { |
| 139 ExpressionStatement* expr = | 138 ExpressionStatement* expr = |
| 140 stmt->statements()->at(0)->AsExpressionStatement(); | 139 stmt->statements()->front()->AsExpressionStatement(); |
| 141 if (expr != nullptr) { | 140 if (expr != nullptr) { |
| 142 if (expr->expression()->IsAssignment()) { | 141 if (expr->expression()->IsAssignment()) { |
| 143 RECURSE(VisitExpressionStatement(expr)); | 142 RECURSE(VisitExpressionStatement(expr)); |
| 144 return; | 143 return; |
| 145 } | 144 } |
| 146 } | 145 } |
| 147 } | 146 } |
| 148 if (scope_ == kFuncScope) { | 147 if (scope_ == kFuncScope) { |
| 149 BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprBlock); | 148 BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprBlock); |
| 150 RECURSE(VisitStatements(stmt->statements())); | 149 RECURSE(VisitStatements(stmt->statements())); |
| (...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer); | 1884 impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer); |
| 1886 return {module_buffer, asm_offsets_buffer}; | 1885 return {module_buffer, asm_offsets_buffer}; |
| 1887 } | 1886 } |
| 1888 | 1887 |
| 1889 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; | 1888 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; |
| 1890 const char* AsmWasmBuilder::single_function_name = "__single_function__"; | 1889 const char* AsmWasmBuilder::single_function_name = "__single_function__"; |
| 1891 | 1890 |
| 1892 } // namespace wasm | 1891 } // namespace wasm |
| 1893 } // namespace internal | 1892 } // namespace internal |
| 1894 } // namespace v8 | 1893 } // namespace v8 |
| OLD | NEW |