Commit 5da687a7 authored by fpizlo@apple.com's avatar fpizlo@apple.com

Showing the data overlay in OpenStreetMap doesn't work, zooming partially broken

https://bugs.webkit.org/show_bug.cgi?id=71505

Source/JavaScriptCore:

Reviewed by Oliver Hunt.

The bytecode generator was assuming that call_varargs never reuses the base register
(i.e. the function being called) for the result. This is no longer true.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCallVarargs):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::ApplyFunctionCallDotNode::emitBytecode):

LayoutTests:

Reviewed by Oliver Hunt.

* fast/js/function-dot-apply-replace-base-expected.txt: Added.
* fast/js/function-dot-apply-replace-base.html: Added.
* fast/js/script-tests/cross-global-object-inline-global-var.js:
(done):
* fast/js/script-tests/function-dot-apply-replace-base.js: Added.
(foo):
(bar):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100879 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 42e40b7a
2011-11-20 Filip Pizlo <fpizlo@apple.com>
Showing the data overlay in OpenStreetMap doesn't work, zooming partially broken
https://bugs.webkit.org/show_bug.cgi?id=71505
Reviewed by Oliver Hunt.
* fast/js/function-dot-apply-replace-base-expected.txt: Added.
* fast/js/function-dot-apply-replace-base.html: Added.
* fast/js/script-tests/cross-global-object-inline-global-var.js:
(done):
* fast/js/script-tests/function-dot-apply-replace-base.js: Added.
(foo):
(bar):
2011-11-20 Adam Barth <abarth@webkit.org>
REGRESSION(r100691): Safari error pages and Growl notifications fail to load stylesheets
This tests that expressions of the form x = x.apply(...) don't break bytecode generation.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS bar() is 3
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/function-dot-apply-replace-base.js"></script>
<script src="resources/js-test-post.js"></script>
</body>
</html>
......@@ -19,8 +19,7 @@ function done(value) {
testPassed("done() called with " + expected);
else
testFailed("done() is " + value + " and should be " + expected + ".");
if (window.layoutTestController)
layoutTestController.notifyDone();
layoutTestController.notifyDone();
}
function doit() {
......
description(
"This tests that expressions of the form x = x.apply(...) don't break bytecode generation."
);
function foo(a,b) {
return a+b;
}
function bar() {
var x;
x = foo;
var array = [];
array.push(1);
array.push(2);
x = x.apply(void(0), array);
return x;
}
shouldBe("bar()", "3");
2011-11-20 Filip Pizlo <fpizlo@apple.com>
Showing the data overlay in OpenStreetMap doesn't work, zooming partially broken
https://bugs.webkit.org/show_bug.cgi?id=71505
Reviewed by Oliver Hunt.
The bytecode generator was assuming that call_varargs never reuses the base register
(i.e. the function being called) for the result. This is no longer true.
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitCallVarargs):
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::ApplyFunctionCallDotNode::emitBytecode):
2011-11-20 Filip Pizlo <fpizlo@apple.com>
DFG 32_64 should directly store double virtual registers on SetLocal
......@@ -1835,12 +1835,12 @@ RegisterID* BytecodeGenerator::emitCall(OpcodeID opcodeID, RegisterID* dst, Regi
return dst;
}
RegisterID* BytecodeGenerator::emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* arguments, RegisterID* firstFreeRegister, unsigned divot, unsigned startOffset, unsigned endOffset)
RegisterID* BytecodeGenerator::emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* arguments, RegisterID* firstFreeRegister, RegisterID* profileHookRegister, unsigned divot, unsigned startOffset, unsigned endOffset)
{
ASSERT(dst != func);
if (m_shouldEmitProfileHooks) {
emitMove(profileHookRegister, func);
emitOpcode(op_profile_will_call);
instructions().append(func->index());
instructions().append(profileHookRegister->index());
}
emitExpressionInfo(divot, startOffset, endOffset);
......@@ -1857,7 +1857,7 @@ RegisterID* BytecodeGenerator::emitCallVarargs(RegisterID* dst, RegisterID* func
}
if (m_shouldEmitProfileHooks) {
emitOpcode(op_profile_did_call);
instructions().append(func->index());
instructions().append(profileHookRegister->index());
}
return dst;
}
......
......@@ -335,7 +335,7 @@ namespace JSC {
RegisterID* emitCall(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
RegisterID* emitCallEval(RegisterID* dst, RegisterID* func, CallArguments&, unsigned divot, unsigned startOffset, unsigned endOffset);
RegisterID* emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* arguments, RegisterID* firstFreeRegister, unsigned divot, unsigned startOffset, unsigned endOffset);
RegisterID* emitCallVarargs(RegisterID* dst, RegisterID* func, RegisterID* thisRegister, RegisterID* arguments, RegisterID* firstFreeRegister, RegisterID* profileHookRegister, unsigned divot, unsigned startOffset, unsigned endOffset);
RegisterID* emitLoadVarargs(RegisterID* argCountDst, RegisterID* thisRegister, RegisterID* args);
RegisterID* emitReturn(RegisterID* src);
......
......@@ -496,6 +496,9 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
}
} else {
ASSERT(m_args->m_listNode && m_args->m_listNode->m_next);
RefPtr<RegisterID> profileHookRegister;
if (generator.shouldEmitProfileHooks())
profileHookRegister = generator.newTemporary();
RefPtr<RegisterID> thisRegister = generator.emitNode(m_args->m_listNode->m_expr);
RefPtr<RegisterID> argsRegister;
ArgumentListNode* args = m_args->m_listNode->m_next;
......@@ -509,7 +512,7 @@ RegisterID* ApplyFunctionCallDotNode::emitBytecode(BytecodeGenerator& generator,
while ((args = args->m_next))
generator.emitNode(args->m_expr);
generator.emitCallVarargs(finalDestinationOrIgnored.get(), base.get(), thisRegister.get(), argsRegister.get(), generator.newTemporary(), divot(), startOffset(), endOffset());
generator.emitCallVarargs(finalDestinationOrIgnored.get(), base.get(), thisRegister.get(), argsRegister.get(), generator.newTemporary(), profileHookRegister.get(), divot(), startOffset(), endOffset());
}
generator.emitJump(end.get());
}
......
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