| Index: src/factory.cc
|
| diff --git a/src/factory.cc b/src/factory.cc
|
| index 9f1f085fc7701362d68d00fed153486fc826467b..65888acbf00d48974464a5e2872b04f078360f0a 100644
|
| --- a/src/factory.cc
|
| +++ b/src/factory.cc
|
| @@ -206,9 +206,8 @@ Handle<TypeFeedbackInfo> Factory::NewTypeFeedbackInfo() {
|
|
|
| // Internalized strings are created in the old generation (data space).
|
| Handle<String> Factory::InternalizeUtf8String(Vector<const char> string) {
|
| - CALL_HEAP_FUNCTION(isolate(),
|
| - isolate()->heap()->InternalizeUtf8String(string),
|
| - String);
|
| + Utf8StringKey key(string, isolate()->heap()->HashSeed());
|
| + return InternalizeStringWithKey(&key);
|
| }
|
|
|
|
|
| @@ -221,24 +220,28 @@ Handle<String> Factory::InternalizeString(Handle<String> string) {
|
|
|
|
|
| Handle<String> Factory::InternalizeOneByteString(Vector<const uint8_t> string) {
|
| - CALL_HEAP_FUNCTION(isolate(),
|
| - isolate()->heap()->InternalizeOneByteString(string),
|
| - String);
|
| + OneByteStringKey key(string, isolate()->heap()->HashSeed());
|
| + return InternalizeStringWithKey(&key);
|
| }
|
|
|
|
|
| Handle<String> Factory::InternalizeOneByteString(
|
| Handle<SeqOneByteString> string, int from, int length) {
|
| - CALL_HEAP_FUNCTION(isolate(),
|
| - isolate()->heap()->InternalizeOneByteString(
|
| - string, from, length),
|
| - String);
|
| + SubStringOneByteStringKey key(string, from, length);
|
| + return InternalizeStringWithKey(&key);
|
| }
|
|
|
|
|
| Handle<String> Factory::InternalizeTwoByteString(Vector<const uc16> string) {
|
| + TwoByteStringKey key(string, isolate()->heap()->HashSeed());
|
| + return InternalizeStringWithKey(&key);
|
| +}
|
| +
|
| +
|
| +template<class StringTableKey>
|
| +Handle<String> Factory::InternalizeStringWithKey(StringTableKey* key) {
|
| CALL_HEAP_FUNCTION(isolate(),
|
| - isolate()->heap()->InternalizeTwoByteString(string),
|
| + isolate()->heap()->InternalizeStringWithKey(key),
|
| String);
|
| }
|
|
|
| @@ -729,7 +732,7 @@ Handle<ExternalArray> Factory::NewExternalArray(int length,
|
| ExternalArrayType array_type,
|
| void* external_pointer,
|
| PretenureFlag pretenure) {
|
| - ASSERT(0 <= length);
|
| + ASSERT(0 <= length && length <= Smi::kMaxValue);
|
| CALL_HEAP_FUNCTION(
|
| isolate(),
|
| isolate()->heap()->AllocateExternalArray(length,
|
| @@ -740,6 +743,20 @@ Handle<ExternalArray> Factory::NewExternalArray(int length,
|
| }
|
|
|
|
|
| +Handle<FixedTypedArrayBase> Factory::NewFixedTypedArray(
|
| + int length,
|
| + ExternalArrayType array_type,
|
| + PretenureFlag pretenure) {
|
| + ASSERT(0 <= length && length <= Smi::kMaxValue);
|
| + CALL_HEAP_FUNCTION(
|
| + isolate(),
|
| + isolate()->heap()->AllocateFixedTypedArray(length,
|
| + array_type,
|
| + pretenure),
|
| + FixedTypedArrayBase);
|
| +}
|
| +
|
| +
|
| Handle<Cell> Factory::NewCell(Handle<Object> value) {
|
| AllowDeferredHandleDereference convert_to_cell;
|
| CALL_HEAP_FUNCTION(
|
|
|