Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Side by Side Diff: src/wasm/asm-wasm-builder.cc

Issue 1968383002: Remove Expression::bounds_, in order to conserve memory during parsing. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove Expression::bounds_ Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 zone_(zone), 53 zone_(zone),
54 foreign_(foreign), 54 foreign_(foreign),
55 typer_(typer), 55 typer_(typer),
56 cache_(TypeCache::Get()), 56 cache_(TypeCache::Get()),
57 breakable_blocks_(zone), 57 breakable_blocks_(zone),
58 init_function_index_(0), 58 init_function_index_(0),
59 next_table_index_(0), 59 next_table_index_(0),
60 function_tables_(HashMap::PointersMatch, 60 function_tables_(HashMap::PointersMatch,
61 ZoneHashMap::kDefaultHashMapCapacity, 61 ZoneHashMap::kDefaultHashMapCapacity,
62 ZoneAllocationPolicy(zone)), 62 ZoneAllocationPolicy(zone)),
63 imported_function_table_(this) { 63 imported_function_table_(this),
64 bounds_(typer->bounds()) {
64 InitializeAstVisitor(isolate); 65 InitializeAstVisitor(isolate);
65 } 66 }
66 67
67 void InitializeInitFunction() { 68 void InitializeInitFunction() {
68 init_function_index_ = builder_->AddFunction(); 69 init_function_index_ = builder_->AddFunction();
69 current_function_builder_ = builder_->FunctionAt(init_function_index_); 70 current_function_builder_ = builder_->FunctionAt(init_function_index_);
70 current_function_builder_->ReturnType(kAstStmt); 71 current_function_builder_->ReturnType(kAstStmt);
71 builder_->MarkStartFunction(init_function_index_); 72 builder_->MarkStartFunction(init_function_index_);
72 current_function_builder_ = nullptr; 73 current_function_builder_ = nullptr;
73 } 74 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 ZoneVector<int32_t> cases(zone_); 314 ZoneVector<int32_t> cases(zone_);
314 ZoneMap<int, unsigned int> case_to_block(zone_); 315 ZoneMap<int, unsigned int> case_to_block(zone_);
315 bool has_default = false; 316 bool has_default = false;
316 for (int i = case_count - 1; i >= 0; i--) { 317 for (int i = case_count - 1; i >= 0; i--) {
317 CaseClause* clause = clauses->at(i); 318 CaseClause* clause = clauses->at(i);
318 blocks.push_back(new BlockVisitor(this, nullptr, kExprBlock, false)); 319 blocks.push_back(new BlockVisitor(this, nullptr, kExprBlock, false));
319 if (!clause->is_default()) { 320 if (!clause->is_default()) {
320 Literal* label = clause->label()->AsLiteral(); 321 Literal* label = clause->label()->AsLiteral();
321 Handle<Object> value = label->value(); 322 Handle<Object> value = label->value();
322 DCHECK(value->IsNumber() && 323 DCHECK(value->IsNumber() &&
323 label->bounds().upper->Is(cache_.kAsmSigned)); 324 bounds_->get(label).upper->Is(cache_.kAsmSigned));
324 int32_t label_value; 325 int32_t label_value;
325 if (!value->ToInt32(&label_value)) { 326 if (!value->ToInt32(&label_value)) {
326 UNREACHABLE(); 327 UNREACHABLE();
327 } 328 }
328 case_to_block[label_value] = i; 329 case_to_block[label_value] = i;
329 cases.push_back(label_value); 330 cases.push_back(label_value);
330 } else { 331 } else {
331 DCHECK_EQ(i, case_count - 1); 332 DCHECK_EQ(i, case_count - 1);
332 has_default = true; 333 has_default = true;
333 } 334 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 408
408 void VisitTryCatchStatement(TryCatchStatement* stmt) { UNREACHABLE(); } 409 void VisitTryCatchStatement(TryCatchStatement* stmt) { UNREACHABLE(); }
409 410
410 void VisitTryFinallyStatement(TryFinallyStatement* stmt) { UNREACHABLE(); } 411 void VisitTryFinallyStatement(TryFinallyStatement* stmt) { UNREACHABLE(); }
411 412
412 void VisitDebuggerStatement(DebuggerStatement* stmt) { UNREACHABLE(); } 413 void VisitDebuggerStatement(DebuggerStatement* stmt) { UNREACHABLE(); }
413 414
414 void VisitFunctionLiteral(FunctionLiteral* expr) { 415 void VisitFunctionLiteral(FunctionLiteral* expr) {
415 Scope* scope = expr->scope(); 416 Scope* scope = expr->scope();
416 if (scope_ == kFuncScope) { 417 if (scope_ == kFuncScope) {
417 if (expr->bounds().lower->IsFunction()) { 418 if (bounds_->get(expr).lower->IsFunction()) {
418 FunctionType* func_type = expr->bounds().lower->AsFunction(); 419 FunctionType* func_type = bounds_->get(expr).lower->AsFunction();
419 LocalType return_type = TypeFrom(func_type->Result()); 420 LocalType return_type = TypeFrom(func_type->Result());
420 current_function_builder_->ReturnType(return_type); 421 current_function_builder_->ReturnType(return_type);
421 for (int i = 0; i < expr->parameter_count(); i++) { 422 for (int i = 0; i < expr->parameter_count(); i++) {
422 LocalType type = TypeFrom(func_type->Parameter(i)); 423 LocalType type = TypeFrom(func_type->Parameter(i));
423 DCHECK_NE(kAstStmt, type); 424 DCHECK_NE(kAstStmt, type);
424 LookupOrInsertLocal(scope->parameter(i), type); 425 LookupOrInsertLocal(scope->parameter(i), type);
425 } 426 }
426 } else { 427 } else {
427 UNREACHABLE(); 428 UNREACHABLE();
428 } 429 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 LookupOrInsertLocal(var, var_type)); 517 LookupOrInsertLocal(var, var_type));
517 } 518 }
518 } 519 }
519 } 520 }
520 521
521 void VisitLiteral(Literal* expr) { 522 void VisitLiteral(Literal* expr) {
522 Handle<Object> value = expr->value(); 523 Handle<Object> value = expr->value();
523 if (!value->IsNumber() || (scope_ != kFuncScope && scope_ != kInitScope)) { 524 if (!value->IsNumber() || (scope_ != kFuncScope && scope_ != kInitScope)) {
524 return; 525 return;
525 } 526 }
526 Type* type = expr->bounds().upper; 527 Type* type = bounds_->get(expr).upper;
527 if (type->Is(cache_.kAsmSigned)) { 528 if (type->Is(cache_.kAsmSigned)) {
528 int32_t i = 0; 529 int32_t i = 0;
529 if (!value->ToInt32(&i)) { 530 if (!value->ToInt32(&i)) {
530 UNREACHABLE(); 531 UNREACHABLE();
531 } 532 }
532 byte code[] = {WASM_I32V(i)}; 533 byte code[] = {WASM_I32V(i)};
533 current_function_builder_->EmitCode(code, sizeof(code)); 534 current_function_builder_->EmitCode(code, sizeof(code));
534 } else if (type->Is(cache_.kAsmUnsigned) || type->Is(cache_.kAsmFixnum)) { 535 } else if (type->Is(cache_.kAsmUnsigned) || type->Is(cache_.kAsmFixnum)) {
535 uint32_t u = 0; 536 uint32_t u = 0;
536 if (!value->ToUint32(&u)) { 537 if (!value->ToUint32(&u)) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 scope_ = kInitScope; 579 scope_ = kInitScope;
579 } 580 }
580 581
581 void UnLoadInitFunction() { 582 void UnLoadInitFunction() {
582 scope_ = kModuleScope; 583 scope_ = kModuleScope;
583 current_function_builder_ = nullptr; 584 current_function_builder_ = nullptr;
584 } 585 }
585 586
586 void AddFunctionTable(VariableProxy* table, ArrayLiteral* funcs) { 587 void AddFunctionTable(VariableProxy* table, ArrayLiteral* funcs) {
587 FunctionType* func_type = 588 FunctionType* func_type =
588 funcs->bounds().lower->AsArray()->Element()->AsFunction(); 589 bounds_->get(funcs).lower->AsArray()->Element()->AsFunction();
589 LocalType return_type = TypeFrom(func_type->Result()); 590 LocalType return_type = TypeFrom(func_type->Result());
590 FunctionSig::Builder sig(zone(), return_type == kAstStmt ? 0 : 1, 591 FunctionSig::Builder sig(zone(), return_type == kAstStmt ? 0 : 1,
591 func_type->Arity()); 592 func_type->Arity());
592 if (return_type != kAstStmt) { 593 if (return_type != kAstStmt) {
593 sig.AddReturn(static_cast<LocalType>(return_type)); 594 sig.AddReturn(static_cast<LocalType>(return_type));
594 } 595 }
595 for (int i = 0; i < func_type->Arity(); i++) { 596 for (int i = 0; i < func_type->Arity(); i++) {
596 sig.AddParam(TypeFrom(func_type->Parameter(i))); 597 sig.AddParam(TypeFrom(func_type->Parameter(i)));
597 } 598 }
598 uint16_t signature_index = builder_->AddSignature(sig.Build()); 599 uint16_t signature_index = builder_->AddSignature(sig.Build());
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 } else { 752 } else {
752 current_function_builder_->EmitSetLocal( 753 current_function_builder_->EmitSetLocal(
753 LookupOrInsertLocal(var, var_type)); 754 LookupOrInsertLocal(var, var_type));
754 } 755 }
755 } 756 }
756 757
757 Property* target_prop = expr->target()->AsProperty(); 758 Property* target_prop = expr->target()->AsProperty();
758 if (target_prop != nullptr) { 759 if (target_prop != nullptr) {
759 // Left hand side is a property access, i.e. the asm.js heap. 760 // Left hand side is a property access, i.e. the asm.js heap.
760 if (TypeOf(expr->value()) == kAstF64 && expr->target()->IsProperty() && 761 if (TypeOf(expr->value()) == kAstF64 && expr->target()->IsProperty() &&
761 expr->target()->AsProperty()->obj()->bounds().lower->Is( 762 bounds_->get(expr->target()->AsProperty()->obj())
762 cache_.kFloat32Array)) { 763 .lower->Is(cache_.kFloat32Array)) {
763 current_function_builder_->Emit(kExprF32ConvertF64); 764 current_function_builder_->Emit(kExprF32ConvertF64);
764 } 765 }
765 WasmOpcode opcode; 766 WasmOpcode opcode;
766 if (type == MachineType::Int8()) { 767 if (type == MachineType::Int8()) {
767 opcode = kExprI32AsmjsStoreMem8; 768 opcode = kExprI32AsmjsStoreMem8;
768 } else if (type == MachineType::Uint8()) { 769 } else if (type == MachineType::Uint8()) {
769 opcode = kExprI32AsmjsStoreMem8; 770 opcode = kExprI32AsmjsStoreMem8;
770 } else if (type == MachineType::Int16()) { 771 } else if (type == MachineType::Int16()) {
771 opcode = kExprI32AsmjsStoreMem16; 772 opcode = kExprI32AsmjsStoreMem16;
772 } else if (type == MachineType::Uint16()) { 773 } else if (type == MachineType::Uint16()) {
(...skipping 19 matching lines...) Expand all
792 793
793 void VisitAssignment(Assignment* expr) { 794 void VisitAssignment(Assignment* expr) {
794 bool as_init = false; 795 bool as_init = false;
795 if (scope_ == kModuleScope) { 796 if (scope_ == kModuleScope) {
796 Property* prop = expr->value()->AsProperty(); 797 Property* prop = expr->value()->AsProperty();
797 if (prop != nullptr) { 798 if (prop != nullptr) {
798 VariableProxy* vp = prop->obj()->AsVariableProxy(); 799 VariableProxy* vp = prop->obj()->AsVariableProxy();
799 if (vp != nullptr && vp->var()->IsParameter() && 800 if (vp != nullptr && vp->var()->IsParameter() &&
800 vp->var()->index() == 1) { 801 vp->var()->index() == 1) {
801 VariableProxy* target = expr->target()->AsVariableProxy(); 802 VariableProxy* target = expr->target()->AsVariableProxy();
802 if (target->bounds().lower->Is(Type::Function())) { 803 if (bounds_->get(target).lower->Is(Type::Function())) {
803 const AstRawString* name = 804 const AstRawString* name =
804 prop->key()->AsLiteral()->AsRawPropertyName(); 805 prop->key()->AsLiteral()->AsRawPropertyName();
805 imported_function_table_.AddImport(target->var(), name->raw_data(), 806 imported_function_table_.AddImport(target->var(), name->raw_data(),
806 name->length()); 807 name->length());
807 } 808 }
808 } 809 }
809 // Property values in module scope don't emit code, so return. 810 // Property values in module scope don't emit code, so return.
810 return; 811 return;
811 } 812 }
812 ArrayLiteral* funcs = expr->value()->AsArrayLiteral(); 813 ArrayLiteral* funcs = expr->value()->AsArrayLiteral();
813 if (funcs != nullptr && 814 if (funcs != nullptr &&
814 funcs->bounds().lower->AsArray()->Element()->IsFunction()) { 815 bounds_->get(funcs).lower->AsArray()->Element()->IsFunction()) {
815 VariableProxy* target = expr->target()->AsVariableProxy(); 816 VariableProxy* target = expr->target()->AsVariableProxy();
816 DCHECK_NOT_NULL(target); 817 DCHECK_NOT_NULL(target);
817 AddFunctionTable(target, funcs); 818 AddFunctionTable(target, funcs);
818 // Only add to the function table. No init needed. 819 // Only add to the function table. No init needed.
819 return; 820 return;
820 } 821 }
821 if (expr->value()->IsCallNew()) { 822 if (expr->value()->IsCallNew()) {
822 // No init code to emit for CallNew nodes. 823 // No init code to emit for CallNew nodes.
823 return; 824 return;
824 } 825 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 byte code[] = {WASM_F64(std::numeric_limits<double>::quiet_NaN())}; 884 byte code[] = {WASM_F64(std::numeric_limits<double>::quiet_NaN())};
884 current_function_builder_->EmitCode(code, sizeof(code)); 885 current_function_builder_->EmitCode(code, sizeof(code));
885 } else { 886 } else {
886 byte code[] = {WASM_I32V_1(0)}; 887 byte code[] = {WASM_I32V_1(0)};
887 current_function_builder_->EmitCode(code, sizeof(code)); 888 current_function_builder_->EmitCode(code, sizeof(code));
888 } 889 }
889 } 890 }
890 891
891 void VisitPropertyAndEmitIndex(Property* expr, MachineType* mtype) { 892 void VisitPropertyAndEmitIndex(Property* expr, MachineType* mtype) {
892 Expression* obj = expr->obj(); 893 Expression* obj = expr->obj();
893 DCHECK_EQ(obj->bounds().lower, obj->bounds().upper); 894 DCHECK_EQ(bounds_->get(obj).lower, bounds_->get(obj).upper);
894 Type* type = obj->bounds().lower; 895 Type* type = bounds_->get(obj).lower;
895 int size; 896 int size;
896 if (type->Is(cache_.kUint8Array)) { 897 if (type->Is(cache_.kUint8Array)) {
897 *mtype = MachineType::Uint8(); 898 *mtype = MachineType::Uint8();
898 size = 1; 899 size = 1;
899 } else if (type->Is(cache_.kInt8Array)) { 900 } else if (type->Is(cache_.kInt8Array)) {
900 *mtype = MachineType::Int8(); 901 *mtype = MachineType::Int8();
901 size = 1; 902 size = 1;
902 } else if (type->Is(cache_.kUint16Array)) { 903 } else if (type->Is(cache_.kUint16Array)) {
903 *mtype = MachineType::Uint16(); 904 *mtype = MachineType::Uint16();
904 size = 2; 905 size = 2;
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 DCHECK_EQ(kFuncScope, scope_); 1255 DCHECK_EQ(kFuncScope, scope_);
1255 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 1256 VariableProxy* proxy = expr->expression()->AsVariableProxy();
1256 if (proxy != nullptr) { 1257 if (proxy != nullptr) {
1257 if (VisitStdlibFunction(expr, proxy)) { 1258 if (VisitStdlibFunction(expr, proxy)) {
1258 return; 1259 return;
1259 } 1260 }
1260 } 1261 }
1261 uint16_t index; 1262 uint16_t index;
1262 VariableProxy* vp = expr->expression()->AsVariableProxy(); 1263 VariableProxy* vp = expr->expression()->AsVariableProxy();
1263 if (vp != nullptr && 1264 if (vp != nullptr &&
1264 Type::Any()->Is(vp->bounds().lower->AsFunction()->Result())) { 1265 Type::Any()->Is(bounds_->get(vp).lower->AsFunction()->Result())) {
1265 LocalType return_type = TypeOf(expr); 1266 LocalType return_type = TypeOf(expr);
1266 ZoneList<Expression*>* args = expr->arguments(); 1267 ZoneList<Expression*>* args = expr->arguments();
1267 FunctionSig::Builder sig(zone(), return_type == kAstStmt ? 0 : 1, 1268 FunctionSig::Builder sig(zone(), return_type == kAstStmt ? 0 : 1,
1268 args->length()); 1269 args->length());
1269 if (return_type != kAstStmt) { 1270 if (return_type != kAstStmt) {
1270 sig.AddReturn(return_type); 1271 sig.AddReturn(return_type);
1271 } 1272 }
1272 for (int i = 0; i < args->length(); i++) { 1273 for (int i = 0; i < args->length(); i++) {
1273 sig.AddParam(TypeOf(args->at(i))); 1274 sig.AddParam(TypeOf(args->at(i)));
1274 } 1275 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 if (left_index == kFixnum && right_index == kFixnum) { 1576 if (left_index == kFixnum && right_index == kFixnum) {
1576 left_index = kInt32; 1577 left_index = kInt32;
1577 right_index = kInt32; 1578 right_index = kInt32;
1578 } 1579 }
1579 DCHECK((left_index == right_index) || 1580 DCHECK((left_index == right_index) ||
1580 (ignore_sign && (left_index <= 1) && (right_index <= 1))); 1581 (ignore_sign && (left_index <= 1) && (right_index <= 1)));
1581 return left_index; 1582 return left_index;
1582 } 1583 }
1583 1584
1584 TypeIndex TypeIndexOf(Expression* expr) { 1585 TypeIndex TypeIndexOf(Expression* expr) {
1585 DCHECK_EQ(expr->bounds().lower, expr->bounds().upper); 1586 DCHECK_EQ(bounds_->get(expr).lower, bounds_->get(expr).upper);
1586 Type* type = expr->bounds().lower; 1587 Type* type = bounds_->get(expr).lower;
1587 if (type->Is(cache_.kAsmFixnum)) { 1588 if (type->Is(cache_.kAsmFixnum)) {
1588 return kFixnum; 1589 return kFixnum;
1589 } else if (type->Is(cache_.kAsmSigned)) { 1590 } else if (type->Is(cache_.kAsmSigned)) {
1590 return kInt32; 1591 return kInt32;
1591 } else if (type->Is(cache_.kAsmUnsigned)) { 1592 } else if (type->Is(cache_.kAsmUnsigned)) {
1592 return kUint32; 1593 return kUint32;
1593 } else if (type->Is(cache_.kAsmInt)) { 1594 } else if (type->Is(cache_.kAsmInt)) {
1594 return kInt32; 1595 return kInt32;
1595 } else if (type->Is(cache_.kAsmFloat)) { 1596 } else if (type->Is(cache_.kAsmFloat)) {
1596 return kFloat32; 1597 return kFloat32;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 IndexContainer* container = new (zone()) IndexContainer(); 1682 IndexContainer* container = new (zone()) IndexContainer();
1682 container->index = index; 1683 container->index = index;
1683 entry = functions_.LookupOrInsert(v, ComputePointerHash(v), 1684 entry = functions_.LookupOrInsert(v, ComputePointerHash(v),
1684 ZoneAllocationPolicy(zone())); 1685 ZoneAllocationPolicy(zone()));
1685 entry->value = container; 1686 entry->value = container;
1686 } 1687 }
1687 return (reinterpret_cast<IndexContainer*>(entry->value))->index; 1688 return (reinterpret_cast<IndexContainer*>(entry->value))->index;
1688 } 1689 }
1689 1690
1690 LocalType TypeOf(Expression* expr) { 1691 LocalType TypeOf(Expression* expr) {
1691 DCHECK_EQ(expr->bounds().lower, expr->bounds().upper); 1692 DCHECK_EQ(bounds_->get(expr).lower, bounds_->get(expr).upper);
1692 return TypeFrom(expr->bounds().lower); 1693 return TypeFrom(bounds_->get(expr).lower);
1693 } 1694 }
1694 1695
1695 LocalType TypeFrom(Type* type) { 1696 LocalType TypeFrom(Type* type) {
1696 if (type->Is(cache_.kAsmInt)) { 1697 if (type->Is(cache_.kAsmInt)) {
1697 return kAstI32; 1698 return kAstI32;
1698 } else if (type->Is(cache_.kAsmFloat)) { 1699 } else if (type->Is(cache_.kAsmFloat)) {
1699 return kAstF32; 1700 return kAstF32;
1700 } else if (type->Is(cache_.kAsmDouble)) { 1701 } else if (type->Is(cache_.kAsmDouble)) {
1701 return kAstF64; 1702 return kAstF64;
1702 } else { 1703 } else {
(...skipping 13 matching lines...) Expand all
1716 Isolate* isolate_; 1717 Isolate* isolate_;
1717 Zone* zone_; 1718 Zone* zone_;
1718 Handle<Object> foreign_; 1719 Handle<Object> foreign_;
1719 AsmTyper* typer_; 1720 AsmTyper* typer_;
1720 TypeCache const& cache_; 1721 TypeCache const& cache_;
1721 ZoneVector<std::pair<BreakableStatement*, bool>> breakable_blocks_; 1722 ZoneVector<std::pair<BreakableStatement*, bool>> breakable_blocks_;
1722 uint16_t init_function_index_; 1723 uint16_t init_function_index_;
1723 uint32_t next_table_index_; 1724 uint32_t next_table_index_;
1724 ZoneHashMap function_tables_; 1725 ZoneHashMap function_tables_;
1725 ImportedFunctionTable imported_function_table_; 1726 ImportedFunctionTable imported_function_table_;
1727 const AstTypeBounds* bounds_;
1726 1728
1727 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS(); 1729 DEFINE_AST_VISITOR_SUBCLASS_MEMBERS();
1728 1730
1729 private: 1731 private:
1730 DISALLOW_COPY_AND_ASSIGN(AsmWasmBuilderImpl); 1732 DISALLOW_COPY_AND_ASSIGN(AsmWasmBuilderImpl);
1731 }; 1733 };
1732 1734
1733 AsmWasmBuilder::AsmWasmBuilder(Isolate* isolate, Zone* zone, 1735 AsmWasmBuilder::AsmWasmBuilder(Isolate* isolate, Zone* zone,
1734 FunctionLiteral* literal, Handle<Object> foreign, 1736 FunctionLiteral* literal, Handle<Object> foreign,
1735 AsmTyper* typer) 1737 AsmTyper* typer)
1736 : isolate_(isolate), 1738 : isolate_(isolate),
1737 zone_(zone), 1739 zone_(zone),
1738 literal_(literal), 1740 literal_(literal),
1739 foreign_(foreign), 1741 foreign_(foreign),
1740 typer_(typer) {} 1742 typer_(typer) {}
1741 1743
1742 // TODO(aseemgarg): probably should take zone (to write wasm to) as input so 1744 // TODO(aseemgarg): probably should take zone (to write wasm to) as input so
1743 // that zone in constructor may be thrown away once wasm module is written. 1745 // that zone in constructor may be thrown away once wasm module is written.
1744 WasmModuleIndex* AsmWasmBuilder::Run() { 1746 WasmModuleIndex* AsmWasmBuilder::Run() {
1745 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, foreign_, typer_); 1747 AsmWasmBuilderImpl impl(isolate_, zone_, literal_, foreign_, typer_);
1746 impl.Compile(); 1748 impl.Compile();
1747 WasmModuleWriter* writer = impl.builder_->Build(zone_); 1749 WasmModuleWriter* writer = impl.builder_->Build(zone_);
1748 return writer->WriteTo(zone_); 1750 return writer->WriteTo(zone_);
1749 } 1751 }
1750 } // namespace wasm 1752 } // namespace wasm
1751 } // namespace internal 1753 } // namespace internal
1752 } // namespace v8 1754 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698