Commit 4e4fc508 authored by kasperl@chromium.org's avatar kasperl@chromium.org

Get ready for fixing issue 120: Pin point the places

where the receiver needs to be patched with the proxy
and get ready of unnecessary function patching on ARM.


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@591 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c128b8d9
......@@ -2240,8 +2240,8 @@ void CodeGenerator::VisitCall(Call* node) {
__ mov(r0, Operand(var->name()));
__ push(r0);
// TODO(120): use JSGlobalObject for function lookup and inline cache,
// and use global proxy as 'this' for invocation.
// TODO(120): Use global object for function lookup and inline
// cache, and use global proxy as 'this' for invocation.
LoadGlobalReceiver(r0);
// Load the arguments.
......@@ -2329,11 +2329,10 @@ void CodeGenerator::VisitCall(Call* node) {
// Load the function.
Load(function);
// Pass the global object as the receiver.
// TODO(120): use JSGlobalObject for function lookup and inline cache,
// and use global proxy as 'this' for invocation.
// Pass the global proxy as the receiver.
LoadGlobalReceiver(r0);
// Call the function.
CallWithArguments(args, node->position());
__ push(r0);
......@@ -2351,9 +2350,10 @@ void CodeGenerator::VisitCallNew(CallNew* node) {
// evaluated.
// Compute function to call and use the global object as the
// receiver.
// receiver. There is no need to use the global proxy here because
// it will always be replaced with a newly allocated object.
Load(node->expression());
LoadGlobalReceiver(r0);
LoadGlobal();
// Push the arguments ("left-to-right") on the stack.
ZoneList<Expression*>* args = node->arguments();
......
......@@ -2660,8 +2660,8 @@ void CodeGenerator::VisitCall(Call* node) {
// Push the name of the function and the receiver onto the stack.
frame_->Push(Immediate(var->name()));
// TODO(120): use JSGlobalObject for function lookup and inline cache,
// and use global proxy as 'this' for invocation.
// TODO(120): Use global object for function lookup and inline
// cache, and use global proxy as 'this' for invocation.
LoadGlobalReceiver(eax);
// Load the arguments.
......@@ -2747,10 +2747,7 @@ void CodeGenerator::VisitCall(Call* node) {
// Load the function.
Load(function);
// Pass the global object as the receiver.
// TODO(120): use JSGlobalObject for function lookup and inline cache,
// and use global proxy as 'this' for invocation.
// Pass the global proxy as the receiver.
LoadGlobalReceiver(eax);
// Call the function.
......@@ -2769,9 +2766,10 @@ void CodeGenerator::VisitCallNew(CallNew* node) {
// evaluated.
// Compute function to call and use the global object as the
// receiver.
// receiver. There is no need to use the global proxy here because
// it will always be replaced with a newly allocated object.
Load(node->expression());
LoadGlobalReceiver(eax);
LoadGlobal();
// Push the arguments ("left-to-right") on the stack.
ZoneList<Expression*>* args = node->arguments();
......
......@@ -365,7 +365,7 @@ void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
// If this assert fails, we have to check upper bound too.
ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
// Check for access to global object (unlikely).
// Check for access to global proxy.
__ cmp(r0, Operand(JS_GLOBAL_PROXY_TYPE));
__ b(eq, &global);
......@@ -383,8 +383,8 @@ void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
__ cmp(r0, Operand(JS_FUNCTION_TYPE));
__ b(ne, &miss);
// Patch the function on the stack; 1 ~ receiver.
__ str(r1, MemOperand(sp, (argc + 1) * kPointerSize));
// TODO(120): Check for access to global object. Needs patching of
// receiver but no security check.
// Invoke the function.
ParameterCount actual(argc);
......@@ -425,13 +425,12 @@ void CallIC::Generate(MacroAssembler* masm,
CEntryStub stub;
__ CallStub(&stub);
// Move result to r1.
// Move result to r1 and leave the internal frame.
__ mov(r1, Operand(r0));
__ LeaveInternalFrame();
// Patch the function on the stack; 1 ~ receiver.
__ str(r1, MemOperand(sp, (argc + 1) * kPointerSize));
// TODO(120): Check for access to to global object. Needs patching
// of receiver but no security check.
// Invoke the function.
ParameterCount actual(argc);
......@@ -485,7 +484,6 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) {
__ cmp(r1, Operand(JS_GLOBAL_PROXY_TYPE));
__ b(eq, &global);
__ bind(&probe);
GenerateDictionaryLoad(masm, &done, &miss, r1, r0);
__ Ret();
......
......@@ -479,7 +479,7 @@ void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
// If this assert fails, we have to check upper bound too.
ASSERT(LAST_TYPE == JS_FUNCTION_TYPE);
// Check for access to global object.
// Check for access to global proxy.
__ cmp(eax, JS_GLOBAL_PROXY_TYPE);
__ j(equal, &global, not_taken);
......@@ -498,11 +498,14 @@ void CallIC::GenerateNormal(MacroAssembler* masm, int argc) {
__ cmp(edx, JS_FUNCTION_TYPE);
__ j(not_equal, &miss, not_taken);
// TODO(120): Check for access to global object. Needs patching of
// receiver but no security check.
// Invoke the function.
ParameterCount actual(argc);
__ InvokeFunction(edi, actual, JUMP_FUNCTION);
// Global object access: Check access rights.
// Global object proxy access: Check access rights.
__ bind(&global);
__ CheckAccessGlobalProxy(edx, eax, &miss);
__ jmp(&probe);
......@@ -542,6 +545,9 @@ void CallIC::Generate(MacroAssembler* masm,
__ mov(Operand(edi), eax);
__ LeaveInternalFrame();
// TODO(120): Check for access to to global object. Needs patching
// of receiver but no security check.
// Invoke the function.
ParameterCount actual(argc);
__ InvokeFunction(edi, actual, JUMP_FUNCTION);
......
......@@ -240,8 +240,9 @@ Object* CallStubCompiler::CompileCallField(Object* object,
__ cmp(r2, Operand(JS_FUNCTION_TYPE));
__ b(ne, &miss);
// Patch the function on the stack; 1 ~ receiver.
__ str(r1, MemOperand(sp, (argc + 1) * kPointerSize));
if (object->IsGlobalObject()) {
// TODO(120): Patch receiver with the global proxy.
}
// Invoke the function.
__ InvokeFunction(r1, arguments(), JUMP_FUNCTION);
......@@ -352,8 +353,9 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
__ mov(r1, Operand(Handle<JSFunction>(function)));
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
// Patch the function on the stack; 1 ~ receiver.
__ str(r1, MemOperand(sp, (argc + 1) * kPointerSize));
if (object->IsGlobalObject()) {
// TODO(120): Patch receiver with the global proxy.
}
// Jump to the cached code (tail call).
Handle<Code> code(function->code());
......
......@@ -478,6 +478,7 @@ Object* StubCompiler::CompileLazyCompile(Code::Flags flags) {
__ CallRuntime(Runtime::kLazyCompile, 1);
__ pop(edi);
// Tear down temporary frame.
__ LeaveInternalFrame();
// Do a tail-call of the compiled function.
......@@ -519,6 +520,10 @@ Object* CallStubCompiler::CompileCallField(Object* object,
__ cmp(ebx, JS_FUNCTION_TYPE);
__ j(not_equal, &miss, not_taken);
if (object->IsGlobalObject()) {
// TODO(120): Patch receiver with the global proxy.
}
// Invoke the function.
__ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
......@@ -627,6 +632,10 @@ Object* CallStubCompiler::CompileCallConstant(Object* object,
__ mov(Operand(edi), Immediate(Handle<JSFunction>(function)));
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
if (object->IsGlobalObject()) {
// TODO(120): Patch receiver with the global proxy.
}
// Jump to the cached code (tail call).
Handle<Code> code(function->code());
ParameterCount expected(function->shared()->formal_parameter_count());
......@@ -697,6 +706,10 @@ Object* CallStubCompiler::CompileCallInterceptor(Object* object,
__ cmp(ebx, JS_FUNCTION_TYPE);
__ j(not_equal, &miss, not_taken);
if (object->IsGlobalObject()) {
// TODO(120): Patch receiver with the global proxy.
}
// Invoke the function.
__ InvokeFunction(edi, arguments(), JUMP_FUNCTION);
......
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