| Index: src/factory.cc
|
| ===================================================================
|
| --- src/factory.cc (revision 8618)
|
| +++ src/factory.cc (working copy)
|
| @@ -1,4 +1,4 @@
|
| -// Copyright 2010 the V8 project authors. All rights reserved.
|
| +// Copyright 2011 the V8 project authors. All rights reserved.
|
| // Redistribution and use in source and binary forms, with or without
|
| // modification, are permitted provided that the following conditions are
|
| // met:
|
| @@ -58,6 +58,16 @@
|
| }
|
|
|
|
|
| +Handle<FixedArray> Factory::NewFixedDoubleArray(int size,
|
| + PretenureFlag pretenure) {
|
| + ASSERT(0 <= size);
|
| + CALL_HEAP_FUNCTION(
|
| + isolate(),
|
| + isolate()->heap()->AllocateUninitializedFixedDoubleArray(size, pretenure),
|
| + FixedArray);
|
| +}
|
| +
|
| +
|
| Handle<StringDictionary> Factory::NewStringDictionary(int at_least_space_for) {
|
| ASSERT(0 <= at_least_space_for);
|
| CALL_HEAP_FUNCTION(isolate(),
|
| @@ -169,21 +179,21 @@
|
| }
|
|
|
|
|
| -Handle<String> Factory::NewRawAsciiString(int length,
|
| - PretenureFlag pretenure) {
|
| +Handle<SeqAsciiString> Factory::NewRawAsciiString(int length,
|
| + PretenureFlag pretenure) {
|
| CALL_HEAP_FUNCTION(
|
| isolate(),
|
| isolate()->heap()->AllocateRawAsciiString(length, pretenure),
|
| - String);
|
| + SeqAsciiString);
|
| }
|
|
|
|
|
| -Handle<String> Factory::NewRawTwoByteString(int length,
|
| - PretenureFlag pretenure) {
|
| +Handle<SeqTwoByteString> Factory::NewRawTwoByteString(int length,
|
| + PretenureFlag pretenure) {
|
| CALL_HEAP_FUNCTION(
|
| isolate(),
|
| isolate()->heap()->AllocateRawTwoByteString(length, pretenure),
|
| - String);
|
| + SeqTwoByteString);
|
| }
|
|
|
|
|
| @@ -204,6 +214,16 @@
|
| }
|
|
|
|
|
| +Handle<String> Factory::NewProperSubString(Handle<String> str,
|
| + int begin,
|
| + int end) {
|
| + ASSERT(begin > 0 || end < str->length());
|
| + CALL_HEAP_FUNCTION(isolate(),
|
| + isolate()->heap()->AllocateSubString(*str, begin, end),
|
| + String);
|
| +}
|
| +
|
| +
|
| Handle<String> Factory::NewExternalStringFromAscii(
|
| ExternalAsciiString::Resource* resource) {
|
| CALL_HEAP_FUNCTION(
|
| @@ -231,26 +251,38 @@
|
|
|
|
|
| Handle<Context> Factory::NewFunctionContext(int length,
|
| - Handle<JSFunction> closure) {
|
| + Handle<JSFunction> function) {
|
| CALL_HEAP_FUNCTION(
|
| isolate(),
|
| - isolate()->heap()->AllocateFunctionContext(length, *closure),
|
| + isolate()->heap()->AllocateFunctionContext(length, *function),
|
| Context);
|
| }
|
|
|
|
|
| -Handle<Context> Factory::NewWithContext(Handle<Context> previous,
|
| - Handle<JSObject> extension,
|
| - bool is_catch_context) {
|
| +Handle<Context> Factory::NewCatchContext(Handle<JSFunction> function,
|
| + Handle<Context> previous,
|
| + Handle<String> name,
|
| + Handle<Object> thrown_object) {
|
| CALL_HEAP_FUNCTION(
|
| isolate(),
|
| - isolate()->heap()->AllocateWithContext(*previous,
|
| - *extension,
|
| - is_catch_context),
|
| + isolate()->heap()->AllocateCatchContext(*function,
|
| + *previous,
|
| + *name,
|
| + *thrown_object),
|
| Context);
|
| }
|
|
|
|
|
| +Handle<Context> Factory::NewWithContext(Handle<JSFunction> function,
|
| + Handle<Context> previous,
|
| + Handle<JSObject> extension) {
|
| + CALL_HEAP_FUNCTION(
|
| + isolate(),
|
| + isolate()->heap()->AllocateWithContext(*function, *previous, *extension),
|
| + Context);
|
| +}
|
| +
|
| +
|
| Handle<Struct> Factory::NewStruct(InstanceType type) {
|
| CALL_HEAP_FUNCTION(
|
| isolate(),
|
| @@ -1189,12 +1221,14 @@
|
| JSRegExp::Flags flags,
|
| int capture_count) {
|
| Handle<FixedArray> store = NewFixedArray(JSRegExp::kIrregexpDataSize);
|
| -
|
| + Smi* uninitialized = Smi::FromInt(JSRegExp::kUninitializedValue);
|
| 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, uninitialized);
|
| + store->set(JSRegExp::kIrregexpUC16CodeIndex, uninitialized);
|
| + store->set(JSRegExp::kIrregexpASCIICodeSavedIndex, uninitialized);
|
| + store->set(JSRegExp::kIrregexpUC16CodeSavedIndex, uninitialized);
|
| store->set(JSRegExp::kIrregexpMaxRegisterCountIndex, Smi::FromInt(0));
|
| store->set(JSRegExp::kIrregexpCaptureCountIndex,
|
| Smi::FromInt(capture_count));
|
|
|