| 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 18 matching lines...) Expand all  Loading... | 
|    29 namespace internal { |    29 namespace internal { | 
|    30 namespace wasm { |    30 namespace wasm { | 
|    31  |    31  | 
|    32 #define RECURSE(call)               \ |    32 #define RECURSE(call)               \ | 
|    33   do {                              \ |    33   do {                              \ | 
|    34     DCHECK(!HasStackOverflow());    \ |    34     DCHECK(!HasStackOverflow());    \ | 
|    35     call;                           \ |    35     call;                           \ | 
|    36     if (HasStackOverflow()) return; \ |    36     if (HasStackOverflow()) return; \ | 
|    37   } while (false) |    37   } while (false) | 
|    38  |    38  | 
 |    39 namespace { | 
 |    40  | 
|    39 enum AsmScope { kModuleScope, kInitScope, kFuncScope, kExportScope }; |    41 enum AsmScope { kModuleScope, kInitScope, kFuncScope, kExportScope }; | 
|    40 enum ValueFate { kDrop, kLeaveOnStack }; |    42 enum ValueFate { kDrop, kLeaveOnStack }; | 
|    41  |    43  | 
|    42 struct ForeignVariable { |    44 struct ForeignVariable { | 
|    43   Handle<Name> name; |    45   Handle<Name> name; | 
|    44   Variable* var; |    46   Variable* var; | 
|    45   ValueType type; |    47   ValueType type; | 
|    46 }; |    48 }; | 
|    47  |    49  | 
 |    50 enum TargetType : uint8_t { NoTarget, BreakTarget, ContinueTarget }; | 
 |    51  | 
 |    52 }  // namespace | 
 |    53  | 
|    48 class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> { |    54 class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> { | 
|    49  public: |    55  public: | 
|    50   AsmWasmBuilderImpl(Isolate* isolate, Zone* zone, CompilationInfo* info, |    56   AsmWasmBuilderImpl(Isolate* isolate, Zone* zone, CompilationInfo* info, | 
|    51                      AstValueFactory* ast_value_factory, Handle<Script> script, |    57                      AstValueFactory* ast_value_factory, Handle<Script> script, | 
|    52                      FunctionLiteral* literal, AsmTyper* typer) |    58                      FunctionLiteral* literal, AsmTyper* typer) | 
|    53       : local_variables_(ZoneHashMap::kDefaultHashMapCapacity, |    59       : local_variables_(ZoneHashMap::kDefaultHashMapCapacity, | 
|    54                          ZoneAllocationPolicy(zone)), |    60                          ZoneAllocationPolicy(zone)), | 
|    55         functions_(ZoneHashMap::kDefaultHashMapCapacity, |    61         functions_(ZoneHashMap::kDefaultHashMapCapacity, | 
|    56                    ZoneAllocationPolicy(zone)), |    62                    ZoneAllocationPolicy(zone)), | 
|    57         global_variables_(ZoneHashMap::kDefaultHashMapCapacity, |    63         global_variables_(ZoneHashMap::kDefaultHashMapCapacity, | 
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   224       ExpressionStatement* expr = |   230       ExpressionStatement* expr = | 
|   225           stmt->statements()->at(0)->AsExpressionStatement(); |   231           stmt->statements()->at(0)->AsExpressionStatement(); | 
|   226       if (expr != nullptr) { |   232       if (expr != nullptr) { | 
|   227         if (expr->expression()->IsAssignment()) { |   233         if (expr->expression()->IsAssignment()) { | 
|   228           RECURSE(VisitExpressionStatement(expr)); |   234           RECURSE(VisitExpressionStatement(expr)); | 
|   229           return; |   235           return; | 
|   230         } |   236         } | 
|   231       } |   237       } | 
|   232     } |   238     } | 
|   233     if (scope_ == kFuncScope) { |   239     if (scope_ == kFuncScope) { | 
|   234       BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprBlock); |   240       BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprBlock, | 
 |   241                            BreakTarget); | 
|   235       RECURSE(VisitStatements(stmt->statements())); |   242       RECURSE(VisitStatements(stmt->statements())); | 
|   236     } else { |   243     } else { | 
|   237       RECURSE(VisitStatements(stmt->statements())); |   244       RECURSE(VisitStatements(stmt->statements())); | 
|   238     } |   245     } | 
|   239   } |   246   } | 
|   240  |   247  | 
|   241   class BlockVisitor { |   248   class BlockVisitor { | 
|   242    private: |   249    private: | 
|   243     AsmWasmBuilderImpl* builder_; |   250     AsmWasmBuilderImpl* builder_; | 
|   244  |   251  | 
|   245    public: |   252    public: | 
|   246     BlockVisitor(AsmWasmBuilderImpl* builder, BreakableStatement* stmt, |   253     BlockVisitor(AsmWasmBuilderImpl* builder, BreakableStatement* stmt, | 
|   247                  WasmOpcode opcode) |   254                  WasmOpcode opcode, TargetType target_type = NoTarget) | 
|   248         : builder_(builder) { |   255         : builder_(builder) { | 
|   249       builder_->breakable_blocks_.push_back( |   256       builder_->breakable_blocks_.emplace_back(stmt, target_type); | 
|   250           std::make_pair(stmt, opcode == kExprLoop)); |  | 
|   251       // block and loops have a type immediate. |   257       // block and loops have a type immediate. | 
|   252       builder_->current_function_builder_->EmitWithU8(opcode, kLocalVoid); |   258       builder_->current_function_builder_->EmitWithU8(opcode, kLocalVoid); | 
|   253     } |   259     } | 
|   254     ~BlockVisitor() { |   260     ~BlockVisitor() { | 
|   255       builder_->current_function_builder_->Emit(kExprEnd); |   261       builder_->current_function_builder_->Emit(kExprEnd); | 
|   256       builder_->breakable_blocks_.pop_back(); |   262       builder_->breakable_blocks_.pop_back(); | 
|   257     } |   263     } | 
|   258   }; |   264   }; | 
|   259  |   265  | 
|   260   void VisitExpressionStatement(ExpressionStatement* stmt) { |   266   void VisitExpressionStatement(ExpressionStatement* stmt) { | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|   288  |   294  | 
|   289   void VisitEmptyStatement(EmptyStatement* stmt) {} |   295   void VisitEmptyStatement(EmptyStatement* stmt) {} | 
|   290  |   296  | 
|   291   void VisitEmptyParentheses(EmptyParentheses* paren) { UNREACHABLE(); } |   297   void VisitEmptyParentheses(EmptyParentheses* paren) { UNREACHABLE(); } | 
|   292  |   298  | 
|   293   void VisitGetIterator(GetIterator* expr) { UNREACHABLE(); } |   299   void VisitGetIterator(GetIterator* expr) { UNREACHABLE(); } | 
|   294  |   300  | 
|   295   void VisitIfStatement(IfStatement* stmt) { |   301   void VisitIfStatement(IfStatement* stmt) { | 
|   296     DCHECK_EQ(kFuncScope, scope_); |   302     DCHECK_EQ(kFuncScope, scope_); | 
|   297     RECURSE(Visit(stmt->condition())); |   303     RECURSE(Visit(stmt->condition())); | 
|   298     current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); |   304     // Wasm ifs come with implicit blocks for both arms. | 
|   299     // WASM ifs come with implement blocks for both arms. |   305     BlockVisitor block(this, nullptr, kExprIf); | 
|   300     breakable_blocks_.push_back(std::make_pair(nullptr, false)); |  | 
|   301     if (stmt->HasThenStatement()) { |   306     if (stmt->HasThenStatement()) { | 
|   302       RECURSE(Visit(stmt->then_statement())); |   307       RECURSE(Visit(stmt->then_statement())); | 
|   303     } |   308     } | 
|   304     if (stmt->HasElseStatement()) { |   309     if (stmt->HasElseStatement()) { | 
|   305       current_function_builder_->Emit(kExprElse); |   310       current_function_builder_->Emit(kExprElse); | 
|   306       RECURSE(Visit(stmt->else_statement())); |   311       RECURSE(Visit(stmt->else_statement())); | 
|   307     } |   312     } | 
|   308     current_function_builder_->Emit(kExprEnd); |  | 
|   309     breakable_blocks_.pop_back(); |  | 
|   310   } |   313   } | 
|   311  |   314  | 
|   312   void DoBreakOrContinue(BreakableStatement* target, bool is_continue) { |   315   void DoBreakOrContinue(BreakableStatement* target, TargetType type) { | 
|   313     DCHECK_EQ(kFuncScope, scope_); |   316     DCHECK_EQ(kFuncScope, scope_); | 
|   314     for (int i = static_cast<int>(breakable_blocks_.size()) - 1; i >= 0; --i) { |   317     for (int i = static_cast<int>(breakable_blocks_.size()) - 1; i >= 0; --i) { | 
|   315       auto elem = breakable_blocks_.at(i); |   318       auto elem = breakable_blocks_.at(i); | 
|   316       if (elem.first == target && elem.second == is_continue) { |   319       if (elem.first == target && elem.second == type) { | 
|   317         int block_distance = static_cast<int>(breakable_blocks_.size() - i - 1); |   320         int block_distance = static_cast<int>(breakable_blocks_.size() - i - 1); | 
|   318         current_function_builder_->Emit(kExprBr); |   321         current_function_builder_->EmitWithVarInt(kExprBr, block_distance); | 
|   319         current_function_builder_->EmitVarInt(block_distance); |  | 
|   320         return; |   322         return; | 
|   321       } |   323       } | 
|   322     } |   324     } | 
|   323     UNREACHABLE();  // statement not found |   325     UNREACHABLE();  // statement not found | 
|   324   } |   326   } | 
|   325  |   327  | 
|   326   void VisitContinueStatement(ContinueStatement* stmt) { |   328   void VisitContinueStatement(ContinueStatement* stmt) { | 
|   327     DoBreakOrContinue(stmt->target(), true); |   329     DoBreakOrContinue(stmt->target(), ContinueTarget); | 
|   328   } |   330   } | 
|   329  |   331  | 
|   330   void VisitBreakStatement(BreakStatement* stmt) { |   332   void VisitBreakStatement(BreakStatement* stmt) { | 
|   331     DoBreakOrContinue(stmt->target(), false); |   333     DoBreakOrContinue(stmt->target(), BreakTarget); | 
|   332   } |   334   } | 
|   333  |   335  | 
|   334   void VisitReturnStatement(ReturnStatement* stmt) { |   336   void VisitReturnStatement(ReturnStatement* stmt) { | 
|   335     if (scope_ == kModuleScope) { |   337     if (scope_ == kModuleScope) { | 
|   336       if (typer_finished_) { |   338       if (typer_finished_) { | 
|   337         typer_->FailWithMessage("Module has multiple returns."); |   339         typer_->FailWithMessage("Module has multiple returns."); | 
|   338         typer_failed_ = true; |   340         typer_failed_ = true; | 
|   339         return; |   341         return; | 
|   340       } |   342       } | 
|   341       if (!typer_->ValidateAfterFunctionsPhase()) { |   343       if (!typer_->ValidateAfterFunctionsPhase()) { | 
| (...skipping 17 matching lines...) Expand all  Loading... | 
|   359   void HandleCase(CaseNode* node, |   361   void HandleCase(CaseNode* node, | 
|   360                   ZoneMap<int, unsigned int>& case_to_block, |   362                   ZoneMap<int, unsigned int>& case_to_block, | 
|   361                   VariableProxy* tag, int default_block, int if_depth) { |   363                   VariableProxy* tag, int default_block, int if_depth) { | 
|   362     int prev_if_depth = if_depth; |   364     int prev_if_depth = if_depth; | 
|   363     if (node->left != nullptr) { |   365     if (node->left != nullptr) { | 
|   364       VisitVariableProxy(tag); |   366       VisitVariableProxy(tag); | 
|   365       current_function_builder_->EmitI32Const(node->begin); |   367       current_function_builder_->EmitI32Const(node->begin); | 
|   366       current_function_builder_->Emit(kExprI32LtS); |   368       current_function_builder_->Emit(kExprI32LtS); | 
|   367       current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); |   369       current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); | 
|   368       if_depth++; |   370       if_depth++; | 
|   369       breakable_blocks_.push_back(std::make_pair(nullptr, false)); |   371       breakable_blocks_.emplace_back(nullptr, NoTarget); | 
|   370       HandleCase(node->left, case_to_block, tag, default_block, if_depth); |   372       HandleCase(node->left, case_to_block, tag, default_block, if_depth); | 
|   371       current_function_builder_->Emit(kExprElse); |   373       current_function_builder_->Emit(kExprElse); | 
|   372     } |   374     } | 
|   373     if (node->right != nullptr) { |   375     if (node->right != nullptr) { | 
|   374       VisitVariableProxy(tag); |   376       VisitVariableProxy(tag); | 
|   375       current_function_builder_->EmitI32Const(node->end); |   377       current_function_builder_->EmitI32Const(node->end); | 
|   376       current_function_builder_->Emit(kExprI32GtS); |   378       current_function_builder_->Emit(kExprI32GtS); | 
|   377       current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); |   379       current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); | 
|   378       if_depth++; |   380       if_depth++; | 
|   379       breakable_blocks_.push_back(std::make_pair(nullptr, false)); |   381       breakable_blocks_.emplace_back(nullptr, NoTarget); | 
|   380       HandleCase(node->right, case_to_block, tag, default_block, if_depth); |   382       HandleCase(node->right, case_to_block, tag, default_block, if_depth); | 
|   381       current_function_builder_->Emit(kExprElse); |   383       current_function_builder_->Emit(kExprElse); | 
|   382     } |   384     } | 
|   383     if (node->begin == node->end) { |   385     if (node->begin == node->end) { | 
|   384       VisitVariableProxy(tag); |   386       VisitVariableProxy(tag); | 
|   385       current_function_builder_->EmitI32Const(node->begin); |   387       current_function_builder_->EmitI32Const(node->begin); | 
|   386       current_function_builder_->Emit(kExprI32Eq); |   388       current_function_builder_->Emit(kExprI32Eq); | 
|   387       current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); |   389       current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); | 
|   388       DCHECK(case_to_block.find(node->begin) != case_to_block.end()); |   390       DCHECK(case_to_block.find(node->begin) != case_to_block.end()); | 
|   389       current_function_builder_->Emit(kExprBr); |   391       current_function_builder_->Emit(kExprBr); | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   423   } |   425   } | 
|   424  |   426  | 
|   425   void VisitSwitchStatement(SwitchStatement* stmt) { |   427   void VisitSwitchStatement(SwitchStatement* stmt) { | 
|   426     VariableProxy* tag = stmt->tag()->AsVariableProxy(); |   428     VariableProxy* tag = stmt->tag()->AsVariableProxy(); | 
|   427     DCHECK_NOT_NULL(tag); |   429     DCHECK_NOT_NULL(tag); | 
|   428     ZoneList<CaseClause*>* clauses = stmt->cases(); |   430     ZoneList<CaseClause*>* clauses = stmt->cases(); | 
|   429     int case_count = clauses->length(); |   431     int case_count = clauses->length(); | 
|   430     if (case_count == 0) { |   432     if (case_count == 0) { | 
|   431       return; |   433       return; | 
|   432     } |   434     } | 
|   433     BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprBlock); |   435     BlockVisitor visitor(this, stmt->AsBreakableStatement(), kExprBlock, | 
 |   436                          BreakTarget); | 
|   434     ZoneVector<BlockVisitor*> blocks(zone_); |   437     ZoneVector<BlockVisitor*> blocks(zone_); | 
|   435     ZoneVector<int32_t> cases(zone_); |   438     ZoneVector<int32_t> cases(zone_); | 
|   436     ZoneMap<int, unsigned int> case_to_block(zone_); |   439     ZoneMap<int, unsigned int> case_to_block(zone_); | 
|   437     bool has_default = false; |   440     bool has_default = false; | 
|   438     for (int i = case_count - 1; i >= 0; --i) { |   441     for (int i = case_count - 1; i >= 0; --i) { | 
|   439       CaseClause* clause = clauses->at(i); |   442       CaseClause* clause = clauses->at(i); | 
|   440       blocks.push_back(new BlockVisitor(this, nullptr, kExprBlock)); |   443       blocks.push_back(new BlockVisitor(this, nullptr, kExprBlock)); | 
|   441       if (!clause->is_default()) { |   444       if (!clause->is_default()) { | 
|   442         Literal* label = clause->label()->AsLiteral(); |   445         Literal* label = clause->label()->AsLiteral(); | 
|   443         Handle<Object> value = label->value(); |   446         Handle<Object> value = label->value(); | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|   469       BlockVisitor* v = blocks.at(case_count - i - 1); |   472       BlockVisitor* v = blocks.at(case_count - i - 1); | 
|   470       blocks.pop_back(); |   473       blocks.pop_back(); | 
|   471       delete v; |   474       delete v; | 
|   472     } |   475     } | 
|   473   } |   476   } | 
|   474  |   477  | 
|   475   void VisitCaseClause(CaseClause* clause) { UNREACHABLE(); } |   478   void VisitCaseClause(CaseClause* clause) { UNREACHABLE(); } | 
|   476  |   479  | 
|   477   void VisitDoWhileStatement(DoWhileStatement* stmt) { |   480   void VisitDoWhileStatement(DoWhileStatement* stmt) { | 
|   478     DCHECK_EQ(kFuncScope, scope_); |   481     DCHECK_EQ(kFuncScope, scope_); | 
|   479     BlockVisitor block(this, stmt->AsBreakableStatement(), kExprBlock); |   482     BlockVisitor block(this, stmt->AsBreakableStatement(), kExprBlock, | 
 |   483                        BreakTarget); | 
|   480     BlockVisitor loop(this, stmt->AsBreakableStatement(), kExprLoop); |   484     BlockVisitor loop(this, stmt->AsBreakableStatement(), kExprLoop); | 
|   481     RECURSE(Visit(stmt->body())); |   485     { | 
 |   486       BlockVisitor inner_block(this, stmt->AsBreakableStatement(), kExprBlock, | 
 |   487                                ContinueTarget); | 
 |   488       RECURSE(Visit(stmt->body())); | 
 |   489     } | 
|   482     RECURSE(Visit(stmt->cond())); |   490     RECURSE(Visit(stmt->cond())); | 
|   483     current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); |   491     current_function_builder_->EmitWithU8(kExprBrIf, 0); | 
|   484     current_function_builder_->EmitWithU8(kExprBr, 1); |  | 
|   485     current_function_builder_->Emit(kExprEnd); |  | 
|   486   } |   492   } | 
|   487  |   493  | 
|   488   void VisitWhileStatement(WhileStatement* stmt) { |   494   void VisitWhileStatement(WhileStatement* stmt) { | 
|   489     DCHECK_EQ(kFuncScope, scope_); |   495     DCHECK_EQ(kFuncScope, scope_); | 
|   490     BlockVisitor block(this, stmt->AsBreakableStatement(), kExprBlock); |   496     BlockVisitor block(this, stmt->AsBreakableStatement(), kExprBlock, | 
|   491     BlockVisitor loop(this, stmt->AsBreakableStatement(), kExprLoop); |   497                        BreakTarget); | 
 |   498     BlockVisitor loop(this, stmt->AsBreakableStatement(), kExprLoop, | 
 |   499                       ContinueTarget); | 
|   492     RECURSE(Visit(stmt->cond())); |   500     RECURSE(Visit(stmt->cond())); | 
|   493     breakable_blocks_.push_back(std::make_pair(nullptr, false)); |   501     BlockVisitor if_block(this, nullptr, kExprIf); | 
|   494     current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); |  | 
|   495     RECURSE(Visit(stmt->body())); |   502     RECURSE(Visit(stmt->body())); | 
|   496     current_function_builder_->EmitWithU8(kExprBr, 1); |   503     current_function_builder_->EmitWithU8(kExprBr, 1); | 
|   497     current_function_builder_->Emit(kExprEnd); |  | 
|   498     breakable_blocks_.pop_back(); |  | 
|   499   } |   504   } | 
|   500  |   505  | 
|   501   void VisitForStatement(ForStatement* stmt) { |   506   void VisitForStatement(ForStatement* stmt) { | 
|   502     DCHECK_EQ(kFuncScope, scope_); |   507     DCHECK_EQ(kFuncScope, scope_); | 
|   503     if (stmt->init() != nullptr) { |   508     if (stmt->init() != nullptr) { | 
|   504       RECURSE(Visit(stmt->init())); |   509       RECURSE(Visit(stmt->init())); | 
|   505     } |   510     } | 
|   506     BlockVisitor block(this, stmt->AsBreakableStatement(), kExprBlock); |   511     BlockVisitor block(this, stmt->AsBreakableStatement(), kExprBlock, | 
|   507     BlockVisitor loop(this, stmt->AsBreakableStatement(), kExprLoop); |   512                        BreakTarget); | 
 |   513     BlockVisitor loop(this, stmt->AsBreakableStatement(), kExprLoop, | 
 |   514                       ContinueTarget); | 
|   508     if (stmt->cond() != nullptr) { |   515     if (stmt->cond() != nullptr) { | 
|   509       RECURSE(Visit(stmt->cond())); |   516       RECURSE(Visit(stmt->cond())); | 
|   510       current_function_builder_->Emit(kExprI32Eqz); |   517       current_function_builder_->Emit(kExprI32Eqz); | 
|   511       current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); |   518       current_function_builder_->EmitWithU8(kExprIf, kLocalVoid); | 
|   512       current_function_builder_->EmitWithU8(kExprBr, 2); |   519       current_function_builder_->EmitWithU8(kExprBr, 2); | 
|   513       current_function_builder_->Emit(kExprEnd); |   520       current_function_builder_->Emit(kExprEnd); | 
|   514     } |   521     } | 
|   515     if (stmt->body() != nullptr) { |   522     if (stmt->body() != nullptr) { | 
|   516       RECURSE(Visit(stmt->body())); |   523       RECURSE(Visit(stmt->body())); | 
|   517     } |   524     } | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   555     } |   562     } | 
|   556   } |   563   } | 
|   557  |   564  | 
|   558   void VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { |   565   void VisitNativeFunctionLiteral(NativeFunctionLiteral* expr) { | 
|   559     UNREACHABLE(); |   566     UNREACHABLE(); | 
|   560   } |   567   } | 
|   561  |   568  | 
|   562   void VisitConditional(Conditional* expr) { |   569   void VisitConditional(Conditional* expr) { | 
|   563     DCHECK_EQ(kFuncScope, scope_); |   570     DCHECK_EQ(kFuncScope, scope_); | 
|   564     RECURSE(Visit(expr->condition())); |   571     RECURSE(Visit(expr->condition())); | 
|   565     // WASM ifs come with implicit blocks for both arms. |   572     // Wasm ifs come with implicit blocks for both arms. | 
|   566     breakable_blocks_.push_back(std::make_pair(nullptr, false)); |   573     breakable_blocks_.emplace_back(nullptr, NoTarget); | 
|   567     ValueTypeCode type; |   574     ValueTypeCode type; | 
|   568     switch (TypeOf(expr)) { |   575     switch (TypeOf(expr)) { | 
|   569       case kWasmI32: |   576       case kWasmI32: | 
|   570         type = kLocalI32; |   577         type = kLocalI32; | 
|   571         break; |   578         break; | 
|   572       case kWasmI64: |   579       case kWasmI64: | 
|   573         type = kLocalI64; |   580         type = kLocalI64; | 
|   574         break; |   581         break; | 
|   575       case kWasmF32: |   582       case kWasmF32: | 
|   576         type = kLocalF32; |   583         type = kLocalF32; | 
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1962   WasmFunctionBuilder* current_function_builder_; |  1969   WasmFunctionBuilder* current_function_builder_; | 
|  1963   FunctionLiteral* literal_; |  1970   FunctionLiteral* literal_; | 
|  1964   Isolate* isolate_; |  1971   Isolate* isolate_; | 
|  1965   Zone* zone_; |  1972   Zone* zone_; | 
|  1966   CompilationInfo* info_; |  1973   CompilationInfo* info_; | 
|  1967   AstValueFactory* ast_value_factory_; |  1974   AstValueFactory* ast_value_factory_; | 
|  1968   Handle<Script> script_; |  1975   Handle<Script> script_; | 
|  1969   AsmTyper* typer_; |  1976   AsmTyper* typer_; | 
|  1970   bool typer_failed_; |  1977   bool typer_failed_; | 
|  1971   bool typer_finished_; |  1978   bool typer_finished_; | 
|  1972   ZoneVector<std::pair<BreakableStatement*, bool>> breakable_blocks_; |  1979   ZoneVector<std::pair<BreakableStatement*, TargetType>> breakable_blocks_; | 
|  1973   ZoneVector<ForeignVariable> foreign_variables_; |  1980   ZoneVector<ForeignVariable> foreign_variables_; | 
|  1974   WasmFunctionBuilder* init_function_; |  1981   WasmFunctionBuilder* init_function_; | 
|  1975   WasmFunctionBuilder* foreign_init_function_; |  1982   WasmFunctionBuilder* foreign_init_function_; | 
|  1976   uint32_t next_table_index_; |  1983   uint32_t next_table_index_; | 
|  1977   ZoneHashMap function_tables_; |  1984   ZoneHashMap function_tables_; | 
|  1978   ImportedFunctionTable imported_function_table_; |  1985   ImportedFunctionTable imported_function_table_; | 
|  1979   // Remember the parent node for reporting the correct location for ToNumber |  1986   // Remember the parent node for reporting the correct location for ToNumber | 
|  1980   // conversions after calls. |  1987   // conversions after calls. | 
|  1981   BinaryOperation* parent_binop_; |  1988   BinaryOperation* parent_binop_; | 
|  1982  |  1989  | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|  2008   impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer); |  2015   impl.builder_->WriteAsmJsOffsetTable(*asm_offsets_buffer); | 
|  2009   return {module_buffer, asm_offsets_buffer, success}; |  2016   return {module_buffer, asm_offsets_buffer, success}; | 
|  2010 } |  2017 } | 
|  2011  |  2018  | 
|  2012 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; |  2019 const char* AsmWasmBuilder::foreign_init_name = "__foreign_init__"; | 
|  2013 const char* AsmWasmBuilder::single_function_name = "__single_function__"; |  2020 const char* AsmWasmBuilder::single_function_name = "__single_function__"; | 
|  2014  |  2021  | 
|  2015 }  // namespace wasm |  2022 }  // namespace wasm | 
|  2016 }  // namespace internal |  2023 }  // namespace internal | 
|  2017 }  // namespace v8 |  2024 }  // namespace v8 | 
| OLD | NEW |