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

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 11413146: MIPS: Get rid of static module allocation, do it in code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 // Push initial value for function declaration. 925 // Push initial value for function declaration.
926 VisitForStackValue(declaration->fun()); 926 VisitForStackValue(declaration->fun());
927 __ CallRuntime(Runtime::kDeclareContextSlot, 4); 927 __ CallRuntime(Runtime::kDeclareContextSlot, 4);
928 break; 928 break;
929 } 929 }
930 } 930 }
931 } 931 }
932 932
933 933
934 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { 934 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
935 VariableProxy* proxy = declaration->proxy(); 935 Variable* variable = declaration->proxy()->var();
936 Variable* variable = proxy->var(); 936 ASSERT(variable->location() == Variable::CONTEXT);
937 Handle<JSModule> instance = declaration->module()->interface()->Instance(); 937 ASSERT(variable->interface()->IsFrozen());
938 ASSERT(!instance.is_null());
939 938
940 switch (variable->location()) { 939 Comment cmnt(masm_, "[ ModuleDeclaration");
941 case Variable::UNALLOCATED: { 940 EmitDebugCheckDeclarationContext(variable);
942 Comment cmnt(masm_, "[ ModuleDeclaration");
943 globals_->Add(variable->name(), zone());
944 globals_->Add(instance, zone());
945 Visit(declaration->module());
946 break;
947 }
948 941
949 case Variable::CONTEXT: { 942 // Load instance object.
950 Comment cmnt(masm_, "[ ModuleDeclaration"); 943 __ LoadContext(a1, scope_->ContextChainLength(scope_->GlobalScope()));
951 EmitDebugCheckDeclarationContext(variable); 944 __ lw(a1, ContextOperand(a1, variable->interface()->Index()));
952 __ li(a1, Operand(instance)); 945 __ lw(a1, ContextOperand(a1, Context::EXTENSION_INDEX));
953 __ sw(a1, ContextOperand(cp, variable->index()));
954 Visit(declaration->module());
955 break;
956 }
957 946
958 case Variable::PARAMETER: 947 // Assign it.
959 case Variable::LOCAL: 948 __ sw(a1, ContextOperand(cp, variable->index()));
960 case Variable::LOOKUP: 949 // We know that we have written a module, which is not a smi.
961 UNREACHABLE(); 950 __ RecordWriteContextSlot(cp,
962 } 951 Context::SlotOffset(variable->index()),
952 a1,
953 a3,
954 kRAHasBeenSaved,
955 kDontSaveFPRegs,
956 EMIT_REMEMBERED_SET,
957 OMIT_SMI_CHECK);
958 PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
959
960 // Traverse into body.
961 Visit(declaration->module());
963 } 962 }
964 963
965 964
966 void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) { 965 void FullCodeGenerator::VisitImportDeclaration(ImportDeclaration* declaration) {
967 VariableProxy* proxy = declaration->proxy(); 966 VariableProxy* proxy = declaration->proxy();
968 Variable* variable = proxy->var(); 967 Variable* variable = proxy->var();
969 switch (variable->location()) { 968 switch (variable->location()) {
970 case Variable::UNALLOCATED: 969 case Variable::UNALLOCATED:
971 // TODO(rossberg) 970 // TODO(rossberg)
972 break; 971 break;
(...skipping 22 matching lines...) Expand all
995 // Call the runtime to declare the globals. 994 // Call the runtime to declare the globals.
996 // The context is the first argument. 995 // The context is the first argument.
997 __ li(a1, Operand(pairs)); 996 __ li(a1, Operand(pairs));
998 __ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags()))); 997 __ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags())));
999 __ Push(cp, a1, a0); 998 __ Push(cp, a1, a0);
1000 __ CallRuntime(Runtime::kDeclareGlobals, 3); 999 __ CallRuntime(Runtime::kDeclareGlobals, 3);
1001 // Return value is ignored. 1000 // Return value is ignored.
1002 } 1001 }
1003 1002
1004 1003
1004 void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) {
1005 // Call the runtime to declare the modules.
1006 __ Push(descriptions);
1007 __ CallRuntime(Runtime::kDeclareModules, 1);
1008 // Return value is ignored.
1009 }
1010
1011
1005 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { 1012 void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
1006 Comment cmnt(masm_, "[ SwitchStatement"); 1013 Comment cmnt(masm_, "[ SwitchStatement");
1007 Breakable nested_statement(this, stmt); 1014 Breakable nested_statement(this, stmt);
1008 SetStatementPosition(stmt); 1015 SetStatementPosition(stmt);
1009 1016
1010 // Keep the switch value on the stack until a case matches. 1017 // Keep the switch value on the stack until a case matches.
1011 VisitForStackValue(stmt->tag()); 1018 VisitForStackValue(stmt->tag());
1012 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); 1019 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
1013 1020
1014 ZoneList<CaseClause*>* clauses = stmt->cases(); 1021 ZoneList<CaseClause*>* clauses = stmt->cases();
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 // eval-introduced variables. Eval is used a lot without 1402 // eval-introduced variables. Eval is used a lot without
1396 // introducing variables. In those cases, we do not want to 1403 // introducing variables. In those cases, we do not want to
1397 // perform a runtime call for all variables in the scope 1404 // perform a runtime call for all variables in the scope
1398 // containing the eval. 1405 // containing the eval.
1399 if (var->mode() == DYNAMIC_GLOBAL) { 1406 if (var->mode() == DYNAMIC_GLOBAL) {
1400 EmitLoadGlobalCheckExtensions(var, typeof_state, slow); 1407 EmitLoadGlobalCheckExtensions(var, typeof_state, slow);
1401 __ Branch(done); 1408 __ Branch(done);
1402 } else if (var->mode() == DYNAMIC_LOCAL) { 1409 } else if (var->mode() == DYNAMIC_LOCAL) {
1403 Variable* local = var->local_if_not_shadowed(); 1410 Variable* local = var->local_if_not_shadowed();
1404 __ lw(v0, ContextSlotOperandCheckExtensions(local, slow)); 1411 __ lw(v0, ContextSlotOperandCheckExtensions(local, slow));
1405 if (local->mode() == CONST || 1412 if (local->mode() == LET ||
1406 local->mode() == CONST_HARMONY || 1413 local->mode() == CONST ||
1407 local->mode() == LET) { 1414 local->mode() == CONST_HARMONY) {
1408 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 1415 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
1409 __ subu(at, v0, at); // Sub as compare: at == 0 on eq. 1416 __ subu(at, v0, at); // Sub as compare: at == 0 on eq.
1410 if (local->mode() == CONST) { 1417 if (local->mode() == CONST) {
1411 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex); 1418 __ LoadRoot(a0, Heap::kUndefinedValueRootIndex);
1412 __ Movz(v0, a0, at); // Conditional move: return Undefined if TheHole. 1419 __ Movz(v0, a0, at); // Conditional move: return Undefined if TheHole.
1413 } else { // LET || CONST_HARMONY 1420 } else { // LET || CONST_HARMONY
1414 __ Branch(done, ne, at, Operand(zero_reg)); 1421 __ Branch(done, ne, at, Operand(zero_reg));
1415 __ li(a0, Operand(var->name())); 1422 __ li(a0, Operand(var->name()));
1416 __ push(a0); 1423 __ push(a0);
1417 __ CallRuntime(Runtime::kThrowReferenceError, 1); 1424 __ CallRuntime(Runtime::kThrowReferenceError, 1);
(...skipping 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after
4550 *context_length = 0; 4557 *context_length = 0;
4551 return previous_; 4558 return previous_;
4552 } 4559 }
4553 4560
4554 4561
4555 #undef __ 4562 #undef __
4556 4563
4557 } } // namespace v8::internal 4564 } } // namespace v8::internal
4558 4565
4559 #endif // V8_TARGET_ARCH_MIPS 4566 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | src/mips/macro-assembler-mips.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698