OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "mark-compact.h" | 41 #include "mark-compact.h" |
42 #include "natives.h" | 42 #include "natives.h" |
43 #include "objects-visiting.h" | 43 #include "objects-visiting.h" |
44 #include "objects-visiting-inl.h" | 44 #include "objects-visiting-inl.h" |
45 #include "once.h" | 45 #include "once.h" |
46 #include "runtime-profiler.h" | 46 #include "runtime-profiler.h" |
47 #include "scopeinfo.h" | 47 #include "scopeinfo.h" |
48 #include "snapshot.h" | 48 #include "snapshot.h" |
49 #include "store-buffer.h" | 49 #include "store-buffer.h" |
50 #include "v8threads.h" | 50 #include "v8threads.h" |
| 51 #include "v8utils.h" |
51 #include "vm-state-inl.h" | 52 #include "vm-state-inl.h" |
52 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP | 53 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP |
53 #include "regexp-macro-assembler.h" | 54 #include "regexp-macro-assembler.h" |
54 #include "arm/regexp-macro-assembler-arm.h" | 55 #include "arm/regexp-macro-assembler-arm.h" |
55 #endif | 56 #endif |
56 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP | 57 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP |
57 #include "regexp-macro-assembler.h" | 58 #include "regexp-macro-assembler.h" |
58 #include "mips/regexp-macro-assembler-mips.h" | 59 #include "mips/regexp-macro-assembler-mips.h" |
59 #endif | 60 #endif |
60 | 61 |
(...skipping 4324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4385 string_result->Set(i++, unibrow::Utf16::LeadSurrogate(r)); | 4386 string_result->Set(i++, unibrow::Utf16::LeadSurrogate(r)); |
4386 string_result->Set(i++, unibrow::Utf16::TrailSurrogate(r)); | 4387 string_result->Set(i++, unibrow::Utf16::TrailSurrogate(r)); |
4387 } else { | 4388 } else { |
4388 string_result->Set(i++, r); | 4389 string_result->Set(i++, r); |
4389 } | 4390 } |
4390 } | 4391 } |
4391 return result; | 4392 return result; |
4392 } | 4393 } |
4393 | 4394 |
4394 | 4395 |
| 4396 MaybeObject* Heap::AllocateStringFromLatin1Slow(Vector<const char> string, |
| 4397 PretenureFlag pretenure) { |
| 4398 int chars = string.length(); |
| 4399 Object* result; |
| 4400 { MaybeObject* maybe_result = AllocateRawTwoByteString(chars, pretenure); |
| 4401 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4402 } |
| 4403 |
| 4404 // Convert and copy the characters into the new object. |
| 4405 SeqTwoByteString* string_result = SeqTwoByteString::cast(result); |
| 4406 CopyChars(string_result->GetChars(), |
| 4407 reinterpret_cast<const unsigned char*>(string.start()), |
| 4408 chars); |
| 4409 return result; |
| 4410 } |
| 4411 |
| 4412 |
4395 MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string, | 4413 MaybeObject* Heap::AllocateStringFromTwoByte(Vector<const uc16> string, |
4396 PretenureFlag pretenure) { | 4414 PretenureFlag pretenure) { |
4397 // Check if the string is an ASCII string. | 4415 // Check if the string is an ASCII string. |
4398 MaybeObject* maybe_result; | 4416 MaybeObject* maybe_result; |
4399 if (String::IsAscii(string.start(), string.length())) { | 4417 if (String::IsAscii(string.start(), string.length())) { |
4400 maybe_result = AllocateRawAsciiString(string.length(), pretenure); | 4418 maybe_result = AllocateRawAsciiString(string.length(), pretenure); |
4401 } else { // It's not an ASCII string. | 4419 } else { // It's not an ASCII string. |
4402 maybe_result = AllocateRawTwoByteString(string.length(), pretenure); | 4420 maybe_result = AllocateRawTwoByteString(string.length(), pretenure); |
4403 } | 4421 } |
4404 Object* result; | 4422 Object* result; |
(...skipping 2842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7247 static_cast<int>(object_sizes_last_time_[index])); | 7265 static_cast<int>(object_sizes_last_time_[index])); |
7248 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7266 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7249 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7267 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7250 | 7268 |
7251 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7269 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7252 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7270 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7253 ClearObjectStats(); | 7271 ClearObjectStats(); |
7254 } | 7272 } |
7255 | 7273 |
7256 } } // namespace v8::internal | 7274 } } // namespace v8::internal |
OLD | NEW |