Commit 1090d8e0 authored by rossberg@chromium.org's avatar rossberg@chromium.org

MIPS: Get rid of static module allocation, do it in code.

Port r13033 (58c2efbb)

BUG=
TEST=

Review URL: https://codereview.chromium.org/11413146
Patch from palfia <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13046 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 79c10a8c
...@@ -932,34 +932,33 @@ void FullCodeGenerator::VisitFunctionDeclaration( ...@@ -932,34 +932,33 @@ void FullCodeGenerator::VisitFunctionDeclaration(
void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
VariableProxy* proxy = declaration->proxy(); Variable* variable = declaration->proxy()->var();
Variable* variable = proxy->var(); ASSERT(variable->location() == Variable::CONTEXT);
Handle<JSModule> instance = declaration->module()->interface()->Instance(); ASSERT(variable->interface()->IsFrozen());
ASSERT(!instance.is_null());
switch (variable->location()) { Comment cmnt(masm_, "[ ModuleDeclaration");
case Variable::UNALLOCATED: { EmitDebugCheckDeclarationContext(variable);
Comment cmnt(masm_, "[ ModuleDeclaration");
globals_->Add(variable->name(), zone());
globals_->Add(instance, zone());
Visit(declaration->module());
break;
}
case Variable::CONTEXT: { // Load instance object.
Comment cmnt(masm_, "[ ModuleDeclaration"); __ LoadContext(a1, scope_->ContextChainLength(scope_->GlobalScope()));
EmitDebugCheckDeclarationContext(variable); __ lw(a1, ContextOperand(a1, variable->interface()->Index()));
__ li(a1, Operand(instance)); __ lw(a1, ContextOperand(a1, Context::EXTENSION_INDEX));
__ sw(a1, ContextOperand(cp, variable->index()));
Visit(declaration->module());
break;
}
case Variable::PARAMETER: // Assign it.
case Variable::LOCAL: __ sw(a1, ContextOperand(cp, variable->index()));
case Variable::LOOKUP: // We know that we have written a module, which is not a smi.
UNREACHABLE(); __ RecordWriteContextSlot(cp,
} Context::SlotOffset(variable->index()),
a1,
a3,
kRAHasBeenSaved,
kDontSaveFPRegs,
EMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
// Traverse into body.
Visit(declaration->module());
} }
...@@ -1002,6 +1001,14 @@ void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { ...@@ -1002,6 +1001,14 @@ void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
} }
void FullCodeGenerator::DeclareModules(Handle<FixedArray> descriptions) {
// Call the runtime to declare the modules.
__ Push(descriptions);
__ CallRuntime(Runtime::kDeclareModules, 1);
// Return value is ignored.
}
void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) {
Comment cmnt(masm_, "[ SwitchStatement"); Comment cmnt(masm_, "[ SwitchStatement");
Breakable nested_statement(this, stmt); Breakable nested_statement(this, stmt);
...@@ -1402,9 +1409,9 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var, ...@@ -1402,9 +1409,9 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var,
} else if (var->mode() == DYNAMIC_LOCAL) { } else if (var->mode() == DYNAMIC_LOCAL) {
Variable* local = var->local_if_not_shadowed(); Variable* local = var->local_if_not_shadowed();
__ lw(v0, ContextSlotOperandCheckExtensions(local, slow)); __ lw(v0, ContextSlotOperandCheckExtensions(local, slow));
if (local->mode() == CONST || if (local->mode() == LET ||
local->mode() == CONST_HARMONY || local->mode() == CONST ||
local->mode() == LET) { local->mode() == CONST_HARMONY) {
__ LoadRoot(at, Heap::kTheHoleValueRootIndex); __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
__ subu(at, v0, at); // Sub as compare: at == 0 on eq. __ subu(at, v0, at); // Sub as compare: at == 0 on eq.
if (local->mode() == CONST) { if (local->mode() == CONST) {
......
...@@ -620,6 +620,7 @@ class MacroAssembler: public Assembler { ...@@ -620,6 +620,7 @@ class MacroAssembler: public Assembler {
// Push a handle. // Push a handle.
void Push(Handle<Object> handle); void Push(Handle<Object> handle);
void Push(Smi* smi) { Push(Handle<Smi>(smi)); }
// Push two registers. Pushes leftmost register first (to highest address). // Push two registers. Pushes leftmost register first (to highest address).
void Push(Register src1, Register src2) { void Push(Register src1, Register src2) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment