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

Unified Diff: src/factory.cc

Issue 8734: Fix 3 places where we were doing retry after GC without using the macros that... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 2 months 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/builtins.cc ('k') | src/jsregexp.cc » ('j') | src/jsregexp.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
===================================================================
--- src/factory.cc (revision 647)
+++ src/factory.cc (working copy)
@@ -452,6 +452,7 @@
return function;
}
+
Handle<Code> Factory::NewCode(const CodeDesc& desc, ScopeInfo<>* sinfo,
Code::Flags flags) {
CALL_HEAP_FUNCTION(Heap::CreateCode(desc, sinfo, flags), Code);
@@ -463,43 +464,27 @@
}
-#define CALL_GC(RETRY) \
- do { \
- if (!Heap::CollectGarbage(Failure::cast(RETRY)->requested(), \
- Failure::cast(RETRY)->allocation_space())) { \
- /* TODO(1181417): Fix this. */ \
- V8::FatalProcessOutOfMemory("Factory CALL_GC"); \
- } \
- } while (false)
+static inline Object* DoCopyInsert(DescriptorArray* array,
+ String* key,
+ Object* value,
+ PropertyAttributes attributes) {
+ CallbacksDescriptor desc(key, value, attributes);
+ Object* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS);
+ return obj;
+}
-// Allocate the new array. We cannot use the CALL_HEAP_FUNCTION macro here,
-// because the stack-allocated CallbacksDescriptor instance is not GC safe.
+// Allocate the new array.
Handle<DescriptorArray> Factory::CopyAppendProxyDescriptor(
Handle<DescriptorArray> array,
Handle<String> key,
Handle<Object> value,
PropertyAttributes attributes) {
- GC_GREEDY_CHECK();
- CallbacksDescriptor desc(*key, *value, attributes);
- Object* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS);
- if (obj->IsFailure()) {
- if (obj->IsRetryAfterGC()) {
- CALL_GC(obj);
- CallbacksDescriptor desc(*key, *value, attributes);
- obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS);
- }
- if (obj->IsFailure()) {
- // TODO(1181417): Fix this.
- V8::FatalProcessOutOfMemory("CopyAppendProxyDescriptor");
- }
- }
- return Handle<DescriptorArray>(DescriptorArray::cast(obj));
+ CALL_HEAP_FUNCTION(DoCopyInsert(*array, *key, *value, attributes),
+ DescriptorArray);
}
-#undef CALL_GC
-
Handle<String> Factory::SymbolFromString(Handle<String> value) {
CALL_HEAP_FUNCTION(Heap::LookupSymbol(*value), String);
}
« no previous file with comments | « src/builtins.cc ('k') | src/jsregexp.cc » ('j') | src/jsregexp.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698