Index: src/factory.cc |
=================================================================== |
--- src/factory.cc (revision 7267) |
+++ src/factory.cc (working copy) |
@@ -41,35 +41,43 @@ |
Handle<FixedArray> Factory::NewFixedArray(int size, PretenureFlag pretenure) { |
ASSERT(0 <= size); |
- CALL_HEAP_FUNCTION(Heap::AllocateFixedArray(size, pretenure), FixedArray); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateFixedArray(size, pretenure), |
+ FixedArray); |
} |
Handle<FixedArray> Factory::NewFixedArrayWithHoles(int size, |
PretenureFlag pretenure) { |
ASSERT(0 <= size); |
- CALL_HEAP_FUNCTION(Heap::AllocateFixedArrayWithHoles(size, pretenure), |
- FixedArray); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateFixedArrayWithHoles(size, pretenure), |
+ FixedArray); |
} |
Handle<StringDictionary> Factory::NewStringDictionary(int at_least_space_for) { |
ASSERT(0 <= at_least_space_for); |
- CALL_HEAP_FUNCTION(StringDictionary::Allocate(at_least_space_for), |
+ CALL_HEAP_FUNCTION(isolate(), |
+ StringDictionary::Allocate(at_least_space_for), |
StringDictionary); |
} |
Handle<NumberDictionary> Factory::NewNumberDictionary(int at_least_space_for) { |
ASSERT(0 <= at_least_space_for); |
- CALL_HEAP_FUNCTION(NumberDictionary::Allocate(at_least_space_for), |
+ CALL_HEAP_FUNCTION(isolate(), |
+ NumberDictionary::Allocate(at_least_space_for), |
NumberDictionary); |
} |
Handle<DescriptorArray> Factory::NewDescriptorArray(int number_of_descriptors) { |
ASSERT(0 <= number_of_descriptors); |
- CALL_HEAP_FUNCTION(DescriptorArray::Allocate(number_of_descriptors), |
+ CALL_HEAP_FUNCTION(isolate(), |
+ DescriptorArray::Allocate(number_of_descriptors), |
DescriptorArray); |
} |
@@ -78,7 +86,8 @@ |
int deopt_entry_count, |
PretenureFlag pretenure) { |
ASSERT(deopt_entry_count > 0); |
- CALL_HEAP_FUNCTION(DeoptimizationInputData::Allocate(deopt_entry_count, |
+ CALL_HEAP_FUNCTION(isolate(), |
+ DeoptimizationInputData::Allocate(deopt_entry_count, |
pretenure), |
DeoptimizationInputData); |
} |
@@ -88,7 +97,8 @@ |
int deopt_entry_count, |
PretenureFlag pretenure) { |
ASSERT(deopt_entry_count > 0); |
- CALL_HEAP_FUNCTION(DeoptimizationOutputData::Allocate(deopt_entry_count, |
+ CALL_HEAP_FUNCTION(isolate(), |
+ DeoptimizationOutputData::Allocate(deopt_entry_count, |
pretenure), |
DeoptimizationOutputData); |
} |
@@ -96,96 +106,137 @@ |
// Symbols are created in the old generation (data space). |
Handle<String> Factory::LookupSymbol(Vector<const char> string) { |
- CALL_HEAP_FUNCTION(Heap::LookupSymbol(string), String); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->LookupSymbol(string), |
+ String); |
} |
Handle<String> Factory::LookupAsciiSymbol(Vector<const char> string) { |
- CALL_HEAP_FUNCTION(Heap::LookupAsciiSymbol(string), String); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->LookupAsciiSymbol(string), |
+ String); |
} |
Handle<String> Factory::LookupTwoByteSymbol(Vector<const uc16> string) { |
- CALL_HEAP_FUNCTION(Heap::LookupTwoByteSymbol(string), String); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->LookupTwoByteSymbol(string), |
+ String); |
} |
Handle<String> Factory::NewStringFromAscii(Vector<const char> string, |
PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateStringFromAscii(string, pretenure), String); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateStringFromAscii(string, pretenure), |
+ String); |
} |
Handle<String> Factory::NewStringFromUtf8(Vector<const char> string, |
PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateStringFromUtf8(string, pretenure), String); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateStringFromUtf8(string, pretenure), |
+ String); |
} |
Handle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string, |
PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateStringFromTwoByte(string, pretenure), |
- String); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateStringFromTwoByte(string, pretenure), |
+ String); |
} |
Handle<String> Factory::NewRawAsciiString(int length, |
PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateRawAsciiString(length, pretenure), String); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateRawAsciiString(length, pretenure), |
+ String); |
} |
Handle<String> Factory::NewRawTwoByteString(int length, |
PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateRawTwoByteString(length, pretenure), String); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateRawTwoByteString(length, pretenure), |
+ String); |
} |
Handle<String> Factory::NewConsString(Handle<String> first, |
Handle<String> second) { |
- CALL_HEAP_FUNCTION(Heap::AllocateConsString(*first, *second), String); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->AllocateConsString(*first, *second), |
+ String); |
} |
Handle<String> Factory::NewSubString(Handle<String> str, |
int begin, |
int end) { |
- CALL_HEAP_FUNCTION(str->SubString(begin, end), String); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ str->SubString(begin, end), |
+ String); |
} |
Handle<String> Factory::NewExternalStringFromAscii( |
ExternalAsciiString::Resource* resource) { |
- CALL_HEAP_FUNCTION(Heap::AllocateExternalStringFromAscii(resource), String); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateExternalStringFromAscii(resource), |
+ String); |
} |
Handle<String> Factory::NewExternalStringFromTwoByte( |
ExternalTwoByteString::Resource* resource) { |
- CALL_HEAP_FUNCTION(Heap::AllocateExternalStringFromTwoByte(resource), String); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateExternalStringFromTwoByte(resource), |
+ String); |
} |
Handle<Context> Factory::NewGlobalContext() { |
- CALL_HEAP_FUNCTION(Heap::AllocateGlobalContext(), Context); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateGlobalContext(), |
+ Context); |
} |
Handle<Context> Factory::NewFunctionContext(int length, |
Handle<JSFunction> closure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateFunctionContext(length, *closure), Context); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateFunctionContext(length, *closure), |
+ Context); |
} |
Handle<Context> Factory::NewWithContext(Handle<Context> previous, |
Handle<JSObject> extension, |
bool is_catch_context) { |
- CALL_HEAP_FUNCTION(Heap::AllocateWithContext(*previous, |
- *extension, |
- is_catch_context), |
- Context); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateWithContext(*previous, |
+ *extension, |
+ is_catch_context), |
+ Context); |
} |
Handle<Struct> Factory::NewStruct(InstanceType type) { |
- CALL_HEAP_FUNCTION(Heap::AllocateStruct(type), Struct); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateStruct(type), |
+ Struct); |
} |
@@ -200,34 +251,35 @@ |
Handle<Script> Factory::NewScript(Handle<String> source) { |
// Generate id for this script. |
int id; |
- if (Heap::last_script_id()->IsUndefined()) { |
+ Heap* heap = isolate()->heap(); |
+ if (heap->last_script_id()->IsUndefined()) { |
// Script ids start from one. |
id = 1; |
} else { |
// Increment id, wrap when positive smi is exhausted. |
- id = Smi::cast(Heap::last_script_id())->value(); |
+ id = Smi::cast(heap->last_script_id())->value(); |
id++; |
if (!Smi::IsValid(id)) { |
id = 0; |
} |
} |
- Heap::SetLastScriptId(Smi::FromInt(id)); |
+ heap->SetLastScriptId(Smi::FromInt(id)); |
// Create and initialize script object. |
- Handle<Proxy> wrapper = Factory::NewProxy(0, TENURED); |
+ Handle<Proxy> wrapper = NewProxy(0, TENURED); |
Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE)); |
script->set_source(*source); |
- script->set_name(Heap::undefined_value()); |
- script->set_id(Heap::last_script_id()); |
+ script->set_name(heap->undefined_value()); |
+ script->set_id(heap->last_script_id()); |
script->set_line_offset(Smi::FromInt(0)); |
script->set_column_offset(Smi::FromInt(0)); |
- script->set_data(Heap::undefined_value()); |
- script->set_context_data(Heap::undefined_value()); |
+ script->set_data(heap->undefined_value()); |
+ script->set_context_data(heap->undefined_value()); |
script->set_type(Smi::FromInt(Script::TYPE_NORMAL)); |
script->set_compilation_type(Smi::FromInt(Script::COMPILATION_TYPE_HOST)); |
script->set_wrapper(*wrapper); |
- script->set_line_ends(Heap::undefined_value()); |
- script->set_eval_from_shared(Heap::undefined_value()); |
+ script->set_line_ends(heap->undefined_value()); |
+ script->set_eval_from_shared(heap->undefined_value()); |
script->set_eval_from_instructions_offset(Smi::FromInt(0)); |
return script; |
@@ -235,7 +287,9 @@ |
Handle<Proxy> Factory::NewProxy(Address addr, PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateProxy(addr, pretenure), Proxy); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->AllocateProxy(addr, pretenure), |
+ Proxy); |
} |
@@ -246,7 +300,10 @@ |
Handle<ByteArray> Factory::NewByteArray(int length, PretenureFlag pretenure) { |
ASSERT(0 <= length); |
- CALL_HEAP_FUNCTION(Heap::AllocateByteArray(length, pretenure), ByteArray); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateByteArray(length, pretenure), |
+ ByteArray); |
} |
@@ -255,32 +312,43 @@ |
void* external_pointer, |
PretenureFlag pretenure) { |
ASSERT(0 <= length); |
- CALL_HEAP_FUNCTION(Heap::AllocateExternalArray(length, |
- array_type, |
- external_pointer, |
- pretenure), ExternalArray); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateExternalArray(length, |
+ array_type, |
+ external_pointer, |
+ pretenure), |
+ ExternalArray); |
} |
Handle<JSGlobalPropertyCell> Factory::NewJSGlobalPropertyCell( |
Handle<Object> value) { |
- CALL_HEAP_FUNCTION(Heap::AllocateJSGlobalPropertyCell(*value), |
- JSGlobalPropertyCell); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateJSGlobalPropertyCell(*value), |
+ JSGlobalPropertyCell); |
} |
Handle<Map> Factory::NewMap(InstanceType type, int instance_size) { |
- CALL_HEAP_FUNCTION(Heap::AllocateMap(type, instance_size), Map); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateMap(type, instance_size), |
+ Map); |
} |
Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { |
- CALL_HEAP_FUNCTION(Heap::AllocateFunctionPrototype(*function), JSObject); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateFunctionPrototype(*function), |
+ JSObject); |
} |
Handle<Map> Factory::CopyMapDropDescriptors(Handle<Map> src) { |
- CALL_HEAP_FUNCTION(src->CopyDropDescriptors(), Map); |
+ CALL_HEAP_FUNCTION(isolate(), src->CopyDropDescriptors(), Map); |
} |
@@ -310,27 +378,27 @@ |
Handle<Map> Factory::CopyMapDropTransitions(Handle<Map> src) { |
- CALL_HEAP_FUNCTION(src->CopyDropTransitions(), Map); |
+ CALL_HEAP_FUNCTION(isolate(), src->CopyDropTransitions(), Map); |
} |
Handle<Map> Factory::GetFastElementsMap(Handle<Map> src) { |
- CALL_HEAP_FUNCTION(src->GetFastElementsMap(), Map); |
+ CALL_HEAP_FUNCTION(isolate(), src->GetFastElementsMap(), Map); |
} |
Handle<Map> Factory::GetSlowElementsMap(Handle<Map> src) { |
- CALL_HEAP_FUNCTION(src->GetSlowElementsMap(), Map); |
+ CALL_HEAP_FUNCTION(isolate(), src->GetSlowElementsMap(), Map); |
} |
Handle<Map> Factory::NewExternalArrayElementsMap(Handle<Map> src) { |
- CALL_HEAP_FUNCTION(src->NewExternalArrayElementsMap(), Map); |
+ CALL_HEAP_FUNCTION(isolate(), src->NewExternalArrayElementsMap(), Map); |
} |
Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { |
- CALL_HEAP_FUNCTION(array->Copy(), FixedArray); |
+ CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray); |
} |
@@ -338,10 +406,12 @@ |
Handle<SharedFunctionInfo> function_info, |
Handle<Map> function_map, |
PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateFunction(*function_map, |
- *function_info, |
- Heap::the_hole_value(), |
- pretenure), |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateFunction(*function_map, |
+ *function_info, |
+ isolate()->heap()->the_hole_value(), |
+ pretenure), |
JSFunction); |
} |
@@ -353,14 +423,13 @@ |
Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo( |
function_info, |
function_info->strict_mode() |
- ? Top::strict_mode_function_map() |
- : Top::function_map(), |
+ ? isolate()->strict_mode_function_map() |
+ : isolate()->function_map(), |
pretenure); |
result->set_context(*context); |
int number_of_literals = function_info->num_literals(); |
- Handle<FixedArray> literals = |
- Factory::NewFixedArray(number_of_literals, pretenure); |
+ Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure); |
if (number_of_literals > 0) { |
// Store the object, regexp and array functions in the literals |
// array prefix. These functions will be used when creating |
@@ -369,7 +438,7 @@ |
context->global_context()); |
} |
result->set_literals(*literals); |
- result->set_next_function_link(Heap::undefined_value()); |
+ result->set_next_function_link(isolate()->heap()->undefined_value()); |
if (V8::UseCrankshaft() && |
FLAG_always_opt && |
@@ -384,23 +453,32 @@ |
Handle<Object> Factory::NewNumber(double value, |
PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::NumberFromDouble(value, pretenure), Object); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->NumberFromDouble(value, pretenure), Object); |
} |
Handle<Object> Factory::NewNumberFromInt(int value) { |
- CALL_HEAP_FUNCTION(Heap::NumberFromInt32(value), Object); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->NumberFromInt32(value), Object); |
} |
Handle<Object> Factory::NewNumberFromUint(uint32_t value) { |
- CALL_HEAP_FUNCTION(Heap::NumberFromUint32(value), Object); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->NumberFromUint32(value), Object); |
} |
Handle<JSObject> Factory::NewNeanderObject() { |
- CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(Heap::neander_map()), |
- JSObject); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateJSObjectFromMap( |
+ isolate()->heap()->neander_map()), |
+ JSObject); |
} |
@@ -450,11 +528,11 @@ |
Handle<Object> Factory::NewError(const char* maker, const char* type, |
Vector< Handle<Object> > args) { |
v8::HandleScope scope; // Instantiate a closeable HandleScope for EscapeFrom. |
- Handle<FixedArray> array = Factory::NewFixedArray(args.length()); |
+ Handle<FixedArray> array = NewFixedArray(args.length()); |
for (int i = 0; i < args.length(); i++) { |
array->set(i, *args[i]); |
} |
- Handle<JSArray> object = Factory::NewJSArrayWithElements(array); |
+ Handle<JSArray> object = NewJSArrayWithElements(array); |
Handle<Object> result = NewError(maker, type, object); |
return result.EscapeFrom(&scope); |
} |
@@ -475,15 +553,15 @@ |
Handle<Object> Factory::NewError(const char* maker, |
const char* type, |
Handle<JSArray> args) { |
- Handle<String> make_str = Factory::LookupAsciiSymbol(maker); |
- Handle<Object> fun_obj(Top::builtins()->GetPropertyNoExceptionThrown( |
- *make_str)); |
+ Handle<String> make_str = LookupAsciiSymbol(maker); |
+ Handle<Object> fun_obj( |
+ isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str)); |
// If the builtins haven't been properly configured yet this error |
// constructor may not have been defined. Bail out. |
if (!fun_obj->IsJSFunction()) |
- return Factory::undefined_value(); |
+ return undefined_value(); |
Handle<JSFunction> fun = Handle<JSFunction>::cast(fun_obj); |
- Handle<Object> type_obj = Factory::LookupAsciiSymbol(type); |
+ Handle<Object> type_obj = LookupAsciiSymbol(type); |
Object** argv[2] = { type_obj.location(), |
Handle<Object>::cast(args).location() }; |
@@ -491,10 +569,7 @@ |
// running the factory method, use the exception as the result. |
bool caught_exception; |
Handle<Object> result = Execution::TryCall(fun, |
- Top::builtins(), |
- 2, |
- argv, |
- &caught_exception); |
+ isolate()->js_builtins_object(), 2, argv, &caught_exception); |
return result; |
} |
@@ -506,21 +581,17 @@ |
Handle<Object> Factory::NewError(const char* constructor, |
Handle<String> message) { |
- Handle<String> constr = Factory::LookupAsciiSymbol(constructor); |
- Handle<JSFunction> fun = |
- Handle<JSFunction>( |
- JSFunction::cast( |
- Top::builtins()->GetPropertyNoExceptionThrown(*constr))); |
+ Handle<String> constr = LookupAsciiSymbol(constructor); |
+ Handle<JSFunction> fun = Handle<JSFunction>( |
+ JSFunction::cast(isolate()->js_builtins_object()-> |
+ GetPropertyNoExceptionThrown(*constr))); |
Object** argv[1] = { Handle<Object>::cast(message).location() }; |
// Invoke the JavaScript factory method. If an exception is thrown while |
// running the factory method, use the exception as the result. |
bool caught_exception; |
Handle<Object> result = Execution::TryCall(fun, |
- Top::builtins(), |
- 1, |
- argv, |
- &caught_exception); |
+ isolate()->js_builtins_object(), 1, argv, &caught_exception); |
return result; |
} |
@@ -581,8 +652,7 @@ |
// property that refers to the function. |
SetPrototypeProperty(function, prototype); |
// Currently safe because it is only invoked from Genesis. |
- SetLocalPropertyNoThrow( |
- prototype, Factory::constructor_symbol(), function, DONT_ENUM); |
+ SetLocalPropertyNoThrow(prototype, constructor_symbol(), function, DONT_ENUM); |
return function; |
} |
@@ -603,17 +673,24 @@ |
Code::Flags flags, |
Handle<Object> self_ref, |
bool immovable) { |
- CALL_HEAP_FUNCTION(Heap::CreateCode(desc, flags, self_ref, immovable), Code); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->CreateCode( |
+ desc, flags, self_ref, immovable), |
+ Code); |
} |
Handle<Code> Factory::CopyCode(Handle<Code> code) { |
- CALL_HEAP_FUNCTION(Heap::CopyCode(*code), Code); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->CopyCode(*code), |
+ Code); |
} |
Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { |
- CALL_HEAP_FUNCTION(Heap::CopyCode(*code, reloc_info), Code); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->CopyCode(*code, reloc_info), |
+ Code); |
} |
@@ -634,13 +711,15 @@ |
Handle<String> key, |
Handle<Object> value, |
PropertyAttributes attributes) { |
- CALL_HEAP_FUNCTION(DoCopyInsert(*array, *key, *value, attributes), |
+ CALL_HEAP_FUNCTION(isolate(), |
+ DoCopyInsert(*array, *key, *value, attributes), |
DescriptorArray); |
} |
Handle<String> Factory::SymbolFromString(Handle<String> value) { |
- CALL_HEAP_FUNCTION(Heap::LookupSymbol(*value), String); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->LookupSymbol(*value), String); |
} |
@@ -705,35 +784,43 @@ |
Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, |
PretenureFlag pretenure) { |
- CALL_HEAP_FUNCTION(Heap::AllocateJSObject(*constructor, pretenure), JSObject); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); |
} |
Handle<GlobalObject> Factory::NewGlobalObject( |
Handle<JSFunction> constructor) { |
- CALL_HEAP_FUNCTION(Heap::AllocateGlobalObject(*constructor), |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->AllocateGlobalObject(*constructor), |
GlobalObject); |
} |
Handle<JSObject> Factory::NewJSObjectFromMap(Handle<Map> map) { |
- CALL_HEAP_FUNCTION(Heap::AllocateJSObjectFromMap(*map, NOT_TENURED), |
- JSObject); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateJSObjectFromMap(*map, NOT_TENURED), |
+ JSObject); |
} |
Handle<JSArray> Factory::NewJSArray(int capacity, |
PretenureFlag pretenure) { |
- Handle<JSObject> obj = NewJSObject(Top::array_function(), pretenure); |
- CALL_HEAP_FUNCTION(Handle<JSArray>::cast(obj)->Initialize(capacity), JSArray); |
+ Handle<JSObject> obj = NewJSObject(isolate()->array_function(), pretenure); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ Handle<JSArray>::cast(obj)->Initialize(capacity), |
+ JSArray); |
} |
Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArray> elements, |
PretenureFlag pretenure) { |
Handle<JSArray> result = |
- Handle<JSArray>::cast(NewJSObject(Top::array_function(), pretenure)); |
+ Handle<JSArray>::cast(NewJSObject(isolate()->array_function(), |
+ pretenure)); |
result->SetContent(*elements); |
return result; |
} |
@@ -767,24 +854,27 @@ |
Handle<Object> script, |
Handle<Object> stack_trace, |
Handle<Object> stack_frames) { |
- CALL_HEAP_FUNCTION(Heap::AllocateJSMessageObject(*type, |
- *arguments, |
- start_position, |
- end_position, |
- *script, |
- *stack_trace, |
- *stack_frames), |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->AllocateJSMessageObject(*type, |
+ *arguments, |
+ start_position, |
+ end_position, |
+ *script, |
+ *stack_trace, |
+ *stack_frames), |
JSMessageObject); |
} |
Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(Handle<String> name) { |
- CALL_HEAP_FUNCTION(Heap::AllocateSharedFunctionInfo(*name), |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->AllocateSharedFunctionInfo(*name), |
SharedFunctionInfo); |
} |
Handle<String> Factory::NumberToString(Handle<Object> number) { |
- CALL_HEAP_FUNCTION(Heap::NumberToString(*number), String); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->NumberToString(*number), String); |
} |
@@ -792,24 +882,28 @@ |
Handle<NumberDictionary> dictionary, |
uint32_t key, |
Handle<Object> value) { |
- CALL_HEAP_FUNCTION(dictionary->AtNumberPut(key, *value), NumberDictionary); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ dictionary->AtNumberPut(key, *value), |
+ NumberDictionary); |
} |
Handle<JSFunction> Factory::NewFunctionHelper(Handle<String> name, |
Handle<Object> prototype) { |
Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); |
- CALL_HEAP_FUNCTION(Heap::AllocateFunction(*Top::function_map(), |
- *function_share, |
- *prototype), |
- JSFunction); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateFunction(*isolate()->function_map(), |
+ *function_share, |
+ *prototype), |
+ JSFunction); |
} |
Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
Handle<Object> prototype) { |
Handle<JSFunction> fun = NewFunctionHelper(name, prototype); |
- fun->set_context(Top::context()->global_context()); |
+ fun->set_context(isolate()->context()->global_context()); |
return fun; |
} |
@@ -819,9 +913,10 @@ |
StrictModeFlag strict_mode) { |
Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name); |
Handle<Map> map = strict_mode == kStrictMode |
- ? Top::strict_mode_function_without_prototype_map() |
- : Top::function_without_prototype_map(); |
- CALL_HEAP_FUNCTION(Heap::AllocateFunction( |
+ ? isolate()->strict_mode_function_without_prototype_map() |
+ : isolate()->function_without_prototype_map(); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ isolate()->heap()->AllocateFunction( |
*map, |
*function_share, |
*the_hole_value()), |
@@ -833,19 +928,19 @@ |
Handle<String> name, |
StrictModeFlag strict_mode) { |
Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name, strict_mode); |
- fun->set_context(Top::context()->global_context()); |
+ fun->set_context(isolate()->context()->global_context()); |
return fun; |
} |
Handle<Object> Factory::ToObject(Handle<Object> object) { |
- CALL_HEAP_FUNCTION(object->ToObject(), Object); |
+ CALL_HEAP_FUNCTION(isolate(), object->ToObject(), Object); |
} |
Handle<Object> Factory::ToObject(Handle<Object> object, |
Handle<Context> global_context) { |
- CALL_HEAP_FUNCTION(object->ToObject(*global_context), Object); |
+ CALL_HEAP_FUNCTION(isolate(), object->ToObject(*global_context), Object); |
} |
@@ -862,13 +957,13 @@ |
// debug info object to avoid allocation while setting up the debug info |
// object. |
Handle<FixedArray> break_points( |
- Factory::NewFixedArray(Debug::kEstimatedNofBreakPointsInFunction)); |
+ NewFixedArray(Debug::kEstimatedNofBreakPointsInFunction)); |
// Create and set up the debug info object. Debug info contains function, a |
// copy of the original code, the executing code and initial fixed array for |
// active break points. |
Handle<DebugInfo> debug_info = |
- Handle<DebugInfo>::cast(Factory::NewStruct(DEBUG_INFO_TYPE)); |
+ Handle<DebugInfo>::cast(NewStruct(DEBUG_INFO_TYPE)); |
debug_info->set_shared(*shared); |
debug_info->set_original_code(*original_code); |
debug_info->set_code(*code); |
@@ -884,15 +979,19 @@ |
Handle<JSObject> Factory::NewArgumentsObject(Handle<Object> callee, |
int length) { |
- CALL_HEAP_FUNCTION(Heap::AllocateArgumentsObject(*callee, length), JSObject); |
+ CALL_HEAP_FUNCTION( |
+ isolate(), |
+ isolate()->heap()->AllocateArgumentsObject(*callee, length), JSObject); |
} |
Handle<JSFunction> Factory::CreateApiFunction( |
Handle<FunctionTemplateInfo> obj, ApiInstanceType instance_type) { |
- Handle<Code> code = Handle<Code>(Builtins::builtin(Builtins::HandleApiCall)); |
+ Handle<Code> code = Handle<Code>(isolate()->builtins()->builtin( |
+ Builtins::HandleApiCall)); |
Handle<Code> construct_stub = |
- Handle<Code>(Builtins::builtin(Builtins::JSConstructStubApi)); |
+ Handle<Code>(isolate()->builtins()->builtin( |
+ Builtins::JSConstructStubApi)); |
int internal_field_count = 0; |
if (!obj->instance_template()->IsUndefined()) { |
@@ -924,11 +1023,11 @@ |
ASSERT(type != INVALID_TYPE); |
Handle<JSFunction> result = |
- Factory::NewFunction(Factory::empty_symbol(), |
- type, |
- instance_size, |
- code, |
- true); |
+ NewFunction(Factory::empty_symbol(), |
+ type, |
+ instance_size, |
+ code, |
+ true); |
// Set class name. |
Handle<Object> class_name = Handle<Object>(obj->class_name()); |
if (class_name->IsString()) { |
@@ -976,7 +1075,7 @@ |
while (true) { |
Handle<Object> props = Handle<Object>(obj->property_accessors()); |
if (!props->IsUndefined()) { |
- array = Factory::CopyAppendCallbackDescriptors(array, props); |
+ array = CopyAppendCallbackDescriptors(array, props); |
} |
Handle<Object> parent = Handle<Object>(obj->parent_template()); |
if (parent->IsUndefined()) break; |
@@ -992,7 +1091,8 @@ |
Handle<MapCache> Factory::NewMapCache(int at_least_space_for) { |
- CALL_HEAP_FUNCTION(MapCache::Allocate(at_least_space_for), MapCache); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ MapCache::Allocate(at_least_space_for), MapCache); |
} |
@@ -1012,7 +1112,8 @@ |
Handle<MapCache> Factory::AddToMapCache(Handle<Context> context, |
Handle<FixedArray> keys, |
Handle<Map> map) { |
- CALL_HEAP_FUNCTION(UpdateMapCacheWith(*context, *keys, *map), MapCache); |
+ CALL_HEAP_FUNCTION(isolate(), |
+ UpdateMapCacheWith(*context, *keys, *map), MapCache); |
} |
@@ -1061,8 +1162,8 @@ |
store->set(JSRegExp::kTagIndex, Smi::FromInt(type)); |
store->set(JSRegExp::kSourceIndex, *source); |
store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value())); |
- store->set(JSRegExp::kIrregexpASCIICodeIndex, Heap::the_hole_value()); |
- store->set(JSRegExp::kIrregexpUC16CodeIndex, Heap::the_hole_value()); |
+ store->set(JSRegExp::kIrregexpASCIICodeIndex, HEAP->the_hole_value()); |
+ store->set(JSRegExp::kIrregexpUC16CodeIndex, HEAP->the_hole_value()); |
store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(0)); |
store->set(JSRegExp::kIrregexpCaptureCountIndex, |
Smi::FromInt(capture_count)); |