Commit ff5e1c98 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Fix asserts and GC unsafeness in stub generation, bug=1689.

Review URL: http://codereview.chromium.org/7920006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9311 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 07469fa5
......@@ -3181,6 +3181,7 @@ void TranscendentalCacheStub::GenerateCallCFunction(MacroAssembler* masm,
} else {
__ vmov(r0, r1, d2);
}
AllowExternalCallThatCantCauseGC scope(masm);
switch (type_) {
case TranscendentalCache::SIN:
__ CallCFunction(ExternalReference::math_sin_double_function(isolate),
......@@ -3334,12 +3335,23 @@ bool CEntryStub::NeedsImmovableCode() {
bool CEntryStub::CompilingCallsToThisStubIsGCSafe() {
return !save_doubles_ && result_size_ == 1;
return (!save_doubles_ || ISOLATE->fp_stubs_generated()) &&
result_size_ == 1;
}
void CodeStub::GenerateStubsAheadOfTime() {
}
void CodeStub::GenerateFPStubs() {
CEntryStub save_doubles(1);
save_doubles.SaveDoubles();
Handle<Code> code = save_doubles.GetCode();
code->GetIsolate()->set_fp_stubs_generated(true);
}
void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
__ Throw(r0);
}
......
......@@ -83,9 +83,11 @@ bool LCodeGen::GenerateCode() {
CpuFeatures::Scope scope1(VFP3);
CpuFeatures::Scope scope2(ARMv7);
CodeStub::GenerateFPStubs();
// Open a frame scope to indicate that there is a frame on the stack. The
// NONE indicates that the scope shouldn't actually generate code to set up
// the frame (that is done in GeneatePrologue).
// the frame (that is done in GeneratePrologue).
FrameScope frame_scope(masm_, StackFrame::NONE);
return GeneratePrologue() &&
......
......@@ -147,8 +147,8 @@ class CodeStub BASE_EMBEDDED {
return MajorKey() <= Instanceof;
}
static void GenerateStubsAheadOfTime();
static void GenerateFPStubs();
// Some stubs put untagged junk on the stack that cannot be scanned by the
// GC. This means that we must be statically sure that no GC can occur while
......
......@@ -4293,7 +4293,8 @@ bool CEntryStub::NeedsImmovableCode() {
bool CEntryStub::CompilingCallsToThisStubIsGCSafe() {
return !save_doubles_ && result_size_ == 1;
return (!save_doubles_ || ISOLATE->fp_stubs_generated()) &&
result_size_ == 1;
}
......@@ -4301,6 +4302,14 @@ void CodeStub::GenerateStubsAheadOfTime() {
}
void CodeStub::GenerateFPStubs() {
CEntryStub save_doubles(1);
save_doubles.SaveDoubles();
Handle<Code> code = save_doubles.GetCode();
code->GetIsolate()->set_fp_stubs_generated(true);
}
void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
__ Throw(eax);
}
......
......@@ -71,6 +71,8 @@ bool LCodeGen::GenerateCode() {
status_ = GENERATING;
CpuFeatures::Scope scope(SSE2);
CodeStub::GenerateFPStubs();
// Open a frame scope to indicate that there is a frame on the stack. The
// MANUAL indicates that the scope shouldn't actually generate code to set up
// the frame (that is done in GeneratePrologue).
......
......@@ -1408,6 +1408,7 @@ Isolate::Isolate()
global_handles_(NULL),
context_switcher_(NULL),
thread_manager_(NULL),
fp_stubs_generated_(false),
string_tracker_(NULL),
regexp_stack_(NULL),
embedder_data_(NULL) {
......
......@@ -879,6 +879,12 @@ class Isolate {
RuntimeState* runtime_state() { return &runtime_state_; }
void set_fp_stubs_generated(bool value) {
fp_stubs_generated_ = value;
}
bool fp_stubs_generated() { return fp_stubs_generated_; }
StaticResource<SafeStringInputBuffer>* compiler_safe_string_input_buffer() {
return &compiler_safe_string_input_buffer_;
}
......@@ -1136,6 +1142,7 @@ class Isolate {
ContextSwitcher* context_switcher_;
ThreadManager* thread_manager_;
RuntimeState runtime_state_;
bool fp_stubs_generated_;
StaticResource<SafeStringInputBuffer> compiler_safe_string_input_buffer_;
Builtins builtins_;
StringTracker* string_tracker_;
......
......@@ -3318,6 +3318,7 @@ void TranscendentalCacheStub::GenerateCallCFunction(MacroAssembler* masm,
} else {
__ mov_d(f12, f4);
}
AllowExternalCallThatCantCauseGC scope(masm);
switch (type_) {
case TranscendentalCache::SIN:
__ CallCFunction(
......@@ -3477,7 +3478,8 @@ bool CEntryStub::NeedsImmovableCode() {
bool CEntryStub::CompilingCallsToThisStubIsGCSafe() {
return !save_doubles_ && result_size_ == 1;
return (!save_doubles_ || ISOLATE->fp_stubs_generated()) &&
result_size_ == 1;
}
......@@ -3485,6 +3487,14 @@ void CodeStub::GenerateStubsAheadOfTime() {
}
void CodeStub::GenerateFPStubs() {
CEntryStub save_doubles(1);
save_doubles.SaveDoubles();
Handle<Code> code = save_doubles.GetCode();
code->GetIsolate()->set_fp_stubs_generated(true);
}
void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
__ Throw(v0);
}
......
......@@ -3336,6 +3336,10 @@ void CodeStub::GenerateStubsAheadOfTime() {
}
void CodeStub::GenerateFPStubs() {
}
void CEntryStub::GenerateThrowTOS(MacroAssembler* masm) {
// Throw exception in eax.
__ Throw(rax);
......
......@@ -84,7 +84,7 @@ bool LCodeGen::GenerateCode() {
// Open a frame scope to indicate that there is a frame on the stack. The
// MANUAL indicates that the scope shouldn't actually generate code to set up
// the frame (that is done in GeneatePrologue).
// the frame (that is done in GeneratePrologue).
FrameScope frame_scope(masm_, StackFrame::MANUAL);
return GeneratePrologue() &&
......
......@@ -69,9 +69,6 @@ js1_5/Array/regress-465980-02: SKIP
ecma_3/Date/15.9.3.2-1: SKIP
js1_2/function/Number: SKIP
# Causes assert to be triggered: http://code.google.com/p/v8/issues/detail?id=1689
js1_5/GC/regress-311497: SKIP
##################### SLOW TESTS #####################
# This takes a long time to run (~100 seconds). It should only be run
......
......@@ -37,9 +37,6 @@ S15.3.4.5_A2: FAIL
# '__proto__' should be treated as a normal property in JSON.
S15.12.2_A1: FAIL
# Assert is triggered by this test: http://code.google.com/p/v8/issues/detail?id=1689
S13_A18: SKIP
##################### DELIBERATE INCOMPATIBILITIES #####################
# This tests precision of trignometric functions. We're slightly off
......
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