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

Unified Diff: src/ia32/stub-cache-ia32.cc

Issue 472002: Fix a crash caused by garbage collection during generation of a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/stub-cache-ia32.cc
===================================================================
--- src/ia32/stub-cache-ia32.cc (revision 3434)
+++ src/ia32/stub-cache-ia32.cc (working copy)
@@ -754,7 +754,7 @@
}
-void StubCompiler::GenerateLoadCallback(JSObject* object,
+bool StubCompiler::GenerateLoadCallback(JSObject* object,
JSObject* holder,
Register receiver,
Register name_reg,
@@ -762,7 +762,8 @@
Register scratch2,
AccessorInfo* callback,
String* name,
- Label* miss) {
+ Label* miss,
+ Failure** failure) {
// Check that the receiver isn't a smi.
__ test(receiver, Immediate(kSmiTagMask));
__ j(zero, miss, not_taken);
@@ -798,7 +799,14 @@
Address getter_address = v8::ToCData<Address>(callback->getter());
ApiFunction fun(getter_address);
ApiGetterEntryStub stub(callback_handle, &fun);
- __ CallStub(&stub);
+ // Calling the stub may try to allocate (if the code is not already
+ // generated). Do not allow the call to perform a garbage
+ // collection but instead return the allocation failure object.
+ Object* result = masm()->TryCallStub(&stub);
+ if (result->IsFailure()) {
+ *failure = Failure::cast(result);
+ return false;
+ }
// We need to avoid using eax since that now holds the result.
Register tmp = other.is(eax) ? reg : other;
@@ -806,6 +814,7 @@
__ LeaveInternalFrame();
__ ret(0);
+ return true;
}
@@ -1420,10 +1429,10 @@
}
-Object* LoadStubCompiler::CompileLoadCallback(JSObject* object,
+Object* LoadStubCompiler::CompileLoadCallback(String* name,
+ JSObject* object,
JSObject* holder,
- AccessorInfo* callback,
- String* name) {
+ AccessorInfo* callback) {
// ----------- S t a t e -------------
// -- ecx : name
// -- esp[0] : return address
@@ -1432,8 +1441,11 @@
Label miss;
__ mov(eax, Operand(esp, kPointerSize));
- GenerateLoadCallback(object, holder, eax, ecx, ebx, edx,
- callback, name, &miss);
+ Failure* failure;
+ bool success = GenerateLoadCallback(object, holder, eax, ecx, ebx, edx,
+ callback, name, &miss, &failure);
+ if (!success) return failure;
+
__ bind(&miss);
GenerateLoadMiss(masm(), Code::LOAD_IC);
@@ -1597,8 +1609,11 @@
__ cmp(Operand(eax), Immediate(Handle<String>(name)));
__ j(not_equal, &miss, not_taken);
- GenerateLoadCallback(receiver, holder, ecx, eax, ebx, edx,
- callback, name, &miss);
+ Failure* failure;
+ bool success = GenerateLoadCallback(receiver, holder, ecx, eax, ebx, edx,
+ callback, name, &miss, &failure);
+ if (!success) return failure;
+
__ bind(&miss);
__ DecrementCounter(&Counters::keyed_load_callback, 1);
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698