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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 value = factory->NewNumberFromUint(static_cast<uint32_t>(1) << 31); | 197 value = factory->NewNumberFromUint(static_cast<uint32_t>(1) << 31); |
198 CHECK(value->IsHeapNumber()); | 198 CHECK(value->IsHeapNumber()); |
199 CHECK(value->IsNumber()); | 199 CHECK(value->IsNumber()); |
200 CHECK_EQ(static_cast<double>(static_cast<uint32_t>(1) << 31), | 200 CHECK_EQ(static_cast<double>(static_cast<uint32_t>(1) << 31), |
201 value->Number()); | 201 value->Number()); |
202 | 202 |
203 // nan oddball checks | 203 // nan oddball checks |
204 CHECK(factory->nan_value()->IsNumber()); | 204 CHECK(factory->nan_value()->IsNumber()); |
205 CHECK(std::isnan(factory->nan_value()->Number())); | 205 CHECK(std::isnan(factory->nan_value()->Number())); |
206 | 206 |
207 Handle<String> s = factory->NewStringFromAscii(CStrVector("fisk hest ")); | 207 Handle<String> s = factory->NewStringFromStaticAscii("fisk hest "); |
208 CHECK(s->IsString()); | 208 CHECK(s->IsString()); |
209 CHECK_EQ(10, s->length()); | 209 CHECK_EQ(10, s->length()); |
210 | 210 |
211 Handle<String> object_string = Handle<String>::cast(factory->Object_string()); | 211 Handle<String> object_string = Handle<String>::cast(factory->Object_string()); |
212 Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object()); | 212 Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object()); |
213 CHECK(JSReceiver::HasLocalProperty(global, object_string)); | 213 CHECK(JSReceiver::HasLocalProperty(global, object_string)); |
214 | 214 |
215 // Check ToString for oddballs | 215 // Check ToString for oddballs |
216 CheckOddball(isolate, heap->true_value(), "true"); | 216 CheckOddball(isolate, heap->true_value(), "true"); |
217 CheckOddball(isolate, heap->false_value(), "false"); | 217 CheckOddball(isolate, heap->false_value(), "false"); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 Handle<Object> obj = | 312 Handle<Object> obj = |
313 Object::GetProperty(global, obj_name).ToHandleChecked(); | 313 Object::GetProperty(global, obj_name).ToHandleChecked(); |
314 CHECK(obj->IsJSObject()); | 314 CHECK(obj->IsJSObject()); |
315 CHECK_EQ(Smi::FromInt(23), | 315 CHECK_EQ(Smi::FromInt(23), |
316 *Object::GetProperty(obj, prop_name).ToHandleChecked()); | 316 *Object::GetProperty(obj, prop_name).ToHandleChecked()); |
317 } | 317 } |
318 | 318 |
319 | 319 |
320 static void VerifyStringAllocation(Isolate* isolate, const char* string) { | 320 static void VerifyStringAllocation(Isolate* isolate, const char* string) { |
321 HandleScope scope(isolate); | 321 HandleScope scope(isolate); |
322 Handle<String> s = isolate->factory()->NewStringFromUtf8(CStrVector(string)); | 322 Handle<String> s = isolate->factory()->NewStringFromUtf8( |
| 323 CStrVector(string)).ToHandleChecked(); |
323 CHECK_EQ(StrLength(string), s->length()); | 324 CHECK_EQ(StrLength(string), s->length()); |
324 for (int index = 0; index < s->length(); index++) { | 325 for (int index = 0; index < s->length(); index++) { |
325 CHECK_EQ(static_cast<uint16_t>(string[index]), s->Get(index)); | 326 CHECK_EQ(static_cast<uint16_t>(string[index]), s->Get(index)); |
326 } | 327 } |
327 } | 328 } |
328 | 329 |
329 | 330 |
330 TEST(String) { | 331 TEST(String) { |
331 CcTest::InitializeVM(); | 332 CcTest::InitializeVM(); |
332 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); | 333 Isolate* isolate = reinterpret_cast<Isolate*>(CcTest::isolate()); |
333 | 334 |
334 VerifyStringAllocation(isolate, "a"); | 335 VerifyStringAllocation(isolate, "a"); |
335 VerifyStringAllocation(isolate, "ab"); | 336 VerifyStringAllocation(isolate, "ab"); |
336 VerifyStringAllocation(isolate, "abc"); | 337 VerifyStringAllocation(isolate, "abc"); |
337 VerifyStringAllocation(isolate, "abcd"); | 338 VerifyStringAllocation(isolate, "abcd"); |
338 VerifyStringAllocation(isolate, "fiskerdrengen er paa havet"); | 339 VerifyStringAllocation(isolate, "fiskerdrengen er paa havet"); |
339 } | 340 } |
340 | 341 |
341 | 342 |
342 TEST(LocalHandles) { | 343 TEST(LocalHandles) { |
343 CcTest::InitializeVM(); | 344 CcTest::InitializeVM(); |
344 Isolate* isolate = CcTest::i_isolate(); | 345 Isolate* isolate = CcTest::i_isolate(); |
345 Factory* factory = isolate->factory(); | 346 Factory* factory = isolate->factory(); |
346 | 347 |
347 v8::HandleScope scope(CcTest::isolate()); | 348 v8::HandleScope scope(CcTest::isolate()); |
348 const char* name = "Kasper the spunky"; | 349 const char* name = "Kasper the spunky"; |
349 Handle<String> string = factory->NewStringFromAscii(CStrVector(name)); | 350 Handle<String> string = factory->NewStringFromAsciiChecked(name); |
350 CHECK_EQ(StrLength(name), string->length()); | 351 CHECK_EQ(StrLength(name), string->length()); |
351 } | 352 } |
352 | 353 |
353 | 354 |
354 TEST(GlobalHandles) { | 355 TEST(GlobalHandles) { |
355 CcTest::InitializeVM(); | 356 CcTest::InitializeVM(); |
356 Isolate* isolate = CcTest::i_isolate(); | 357 Isolate* isolate = CcTest::i_isolate(); |
357 Heap* heap = isolate->heap(); | 358 Heap* heap = isolate->heap(); |
358 Factory* factory = isolate->factory(); | 359 Factory* factory = isolate->factory(); |
359 GlobalHandles* global_handles = isolate->global_handles(); | 360 GlobalHandles* global_handles = isolate->global_handles(); |
360 | 361 |
361 Handle<Object> h1; | 362 Handle<Object> h1; |
362 Handle<Object> h2; | 363 Handle<Object> h2; |
363 Handle<Object> h3; | 364 Handle<Object> h3; |
364 Handle<Object> h4; | 365 Handle<Object> h4; |
365 | 366 |
366 { | 367 { |
367 HandleScope scope(isolate); | 368 HandleScope scope(isolate); |
368 | 369 |
369 Handle<Object> i = factory->NewStringFromAscii(CStrVector("fisk")); | 370 Handle<Object> i = factory->NewStringFromStaticAscii("fisk"); |
370 Handle<Object> u = factory->NewNumber(1.12344); | 371 Handle<Object> u = factory->NewNumber(1.12344); |
371 | 372 |
372 h1 = global_handles->Create(*i); | 373 h1 = global_handles->Create(*i); |
373 h2 = global_handles->Create(*u); | 374 h2 = global_handles->Create(*u); |
374 h3 = global_handles->Create(*i); | 375 h3 = global_handles->Create(*i); |
375 h4 = global_handles->Create(*u); | 376 h4 = global_handles->Create(*u); |
376 } | 377 } |
377 | 378 |
378 // after gc, it should survive | 379 // after gc, it should survive |
379 heap->CollectGarbage(NEW_SPACE); | 380 heap->CollectGarbage(NEW_SPACE); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 GlobalHandles* global_handles = isolate->global_handles(); | 415 GlobalHandles* global_handles = isolate->global_handles(); |
415 | 416 |
416 WeakPointerCleared = false; | 417 WeakPointerCleared = false; |
417 | 418 |
418 Handle<Object> h1; | 419 Handle<Object> h1; |
419 Handle<Object> h2; | 420 Handle<Object> h2; |
420 | 421 |
421 { | 422 { |
422 HandleScope scope(isolate); | 423 HandleScope scope(isolate); |
423 | 424 |
424 Handle<Object> i = factory->NewStringFromAscii(CStrVector("fisk")); | 425 Handle<Object> i = factory->NewStringFromStaticAscii("fisk"); |
425 Handle<Object> u = factory->NewNumber(1.12344); | 426 Handle<Object> u = factory->NewNumber(1.12344); |
426 | 427 |
427 h1 = global_handles->Create(*i); | 428 h1 = global_handles->Create(*i); |
428 h2 = global_handles->Create(*u); | 429 h2 = global_handles->Create(*u); |
429 } | 430 } |
430 | 431 |
431 std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234); | 432 std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234); |
432 GlobalHandles::MakeWeak(h2.location(), | 433 GlobalHandles::MakeWeak(h2.location(), |
433 reinterpret_cast<void*>(&handle_and_id), | 434 reinterpret_cast<void*>(&handle_and_id), |
434 &TestWeakGlobalHandleCallback); | 435 &TestWeakGlobalHandleCallback); |
(...skipping 21 matching lines...) Expand all Loading... |
456 GlobalHandles* global_handles = isolate->global_handles(); | 457 GlobalHandles* global_handles = isolate->global_handles(); |
457 | 458 |
458 WeakPointerCleared = false; | 459 WeakPointerCleared = false; |
459 | 460 |
460 Handle<Object> h1; | 461 Handle<Object> h1; |
461 Handle<Object> h2; | 462 Handle<Object> h2; |
462 | 463 |
463 { | 464 { |
464 HandleScope scope(isolate); | 465 HandleScope scope(isolate); |
465 | 466 |
466 Handle<Object> i = factory->NewStringFromAscii(CStrVector("fisk")); | 467 Handle<Object> i = factory->NewStringFromStaticAscii("fisk"); |
467 Handle<Object> u = factory->NewNumber(1.12344); | 468 Handle<Object> u = factory->NewNumber(1.12344); |
468 | 469 |
469 h1 = global_handles->Create(*i); | 470 h1 = global_handles->Create(*i); |
470 h2 = global_handles->Create(*u); | 471 h2 = global_handles->Create(*u); |
471 } | 472 } |
472 | 473 |
473 // Make sure the objects are promoted. | 474 // Make sure the objects are promoted. |
474 heap->CollectGarbage(OLD_POINTER_SPACE); | 475 heap->CollectGarbage(OLD_POINTER_SPACE); |
475 heap->CollectGarbage(NEW_SPACE); | 476 heap->CollectGarbage(NEW_SPACE); |
476 CHECK(!heap->InNewSpace(*h1) && !heap->InNewSpace(*h2)); | 477 CHECK(!heap->InNewSpace(*h1) && !heap->InNewSpace(*h2)); |
(...skipping 25 matching lines...) Expand all Loading... |
502 Factory* factory = isolate->factory(); | 503 Factory* factory = isolate->factory(); |
503 GlobalHandles* global_handles = isolate->global_handles(); | 504 GlobalHandles* global_handles = isolate->global_handles(); |
504 | 505 |
505 WeakPointerCleared = false; | 506 WeakPointerCleared = false; |
506 | 507 |
507 Handle<Object> h; | 508 Handle<Object> h; |
508 | 509 |
509 { | 510 { |
510 HandleScope scope(isolate); | 511 HandleScope scope(isolate); |
511 | 512 |
512 Handle<Object> i = factory->NewStringFromAscii(CStrVector("fisk")); | 513 Handle<Object> i = factory->NewStringFromStaticAscii("fisk"); |
513 h = global_handles->Create(*i); | 514 h = global_handles->Create(*i); |
514 } | 515 } |
515 | 516 |
516 std::pair<Handle<Object>*, int> handle_and_id(&h, 1234); | 517 std::pair<Handle<Object>*, int> handle_and_id(&h, 1234); |
517 GlobalHandles::MakeWeak(h.location(), | 518 GlobalHandles::MakeWeak(h.location(), |
518 reinterpret_cast<void*>(&handle_and_id), | 519 reinterpret_cast<void*>(&handle_and_id), |
519 &TestWeakGlobalHandleCallback); | 520 &TestWeakGlobalHandleCallback); |
520 | 521 |
521 // Scanvenge does not recognize weak reference. | 522 // Scanvenge does not recognize weak reference. |
522 heap->CollectGarbage(NEW_SPACE); | 523 heap->CollectGarbage(NEW_SPACE); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 | 697 |
697 // delete second and then first | 698 // delete second and then first |
698 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION).Check(); | 699 JSReceiver::DeleteProperty(obj, second, JSReceiver::NORMAL_DELETION).Check(); |
699 CHECK(JSReceiver::HasLocalProperty(obj, first)); | 700 CHECK(JSReceiver::HasLocalProperty(obj, first)); |
700 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check(); | 701 JSReceiver::DeleteProperty(obj, first, JSReceiver::NORMAL_DELETION).Check(); |
701 CHECK(!JSReceiver::HasLocalProperty(obj, first)); | 702 CHECK(!JSReceiver::HasLocalProperty(obj, first)); |
702 CHECK(!JSReceiver::HasLocalProperty(obj, second)); | 703 CHECK(!JSReceiver::HasLocalProperty(obj, second)); |
703 | 704 |
704 // check string and internalized string match | 705 // check string and internalized string match |
705 const char* string1 = "fisk"; | 706 const char* string1 = "fisk"; |
706 Handle<String> s1 = factory->NewStringFromAscii(CStrVector(string1)); | 707 Handle<String> s1 = factory->NewStringFromAsciiChecked(string1); |
707 JSReceiver::SetProperty(obj, s1, one, NONE, SLOPPY).Check(); | 708 JSReceiver::SetProperty(obj, s1, one, NONE, SLOPPY).Check(); |
708 Handle<String> s1_string = factory->InternalizeUtf8String(string1); | 709 Handle<String> s1_string = factory->InternalizeUtf8String(string1); |
709 CHECK(JSReceiver::HasLocalProperty(obj, s1_string)); | 710 CHECK(JSReceiver::HasLocalProperty(obj, s1_string)); |
710 | 711 |
711 // check internalized string and string match | 712 // check internalized string and string match |
712 const char* string2 = "fugl"; | 713 const char* string2 = "fugl"; |
713 Handle<String> s2_string = factory->InternalizeUtf8String(string2); | 714 Handle<String> s2_string = factory->InternalizeUtf8String(string2); |
714 JSReceiver::SetProperty(obj, s2_string, one, NONE, SLOPPY).Check(); | 715 JSReceiver::SetProperty(obj, s2_string, one, NONE, SLOPPY).Check(); |
715 Handle<String> s2 = factory->NewStringFromAscii(CStrVector(string2)); | 716 Handle<String> s2 = factory->NewStringFromAsciiChecked(string2); |
716 CHECK(JSReceiver::HasLocalProperty(obj, s2)); | 717 CHECK(JSReceiver::HasLocalProperty(obj, s2)); |
717 } | 718 } |
718 | 719 |
719 | 720 |
720 TEST(JSObjectMaps) { | 721 TEST(JSObjectMaps) { |
721 CcTest::InitializeVM(); | 722 CcTest::InitializeVM(); |
722 Isolate* isolate = CcTest::i_isolate(); | 723 Isolate* isolate = CcTest::i_isolate(); |
723 Factory* factory = isolate->factory(); | 724 Factory* factory = isolate->factory(); |
724 | 725 |
725 v8::HandleScope sc(CcTest::isolate()); | 726 v8::HandleScope sc(CcTest::isolate()); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 non_ascii[3 * i + 1] = chars[1]; | 868 non_ascii[3 * i + 1] = chars[1]; |
868 non_ascii[3 * i + 2] = chars[2]; | 869 non_ascii[3 * i + 2] = chars[2]; |
869 } | 870 } |
870 Handle<String> non_ascii_sym = | 871 Handle<String> non_ascii_sym = |
871 factory->InternalizeUtf8String( | 872 factory->InternalizeUtf8String( |
872 Vector<const char>(non_ascii, 3 * length)); | 873 Vector<const char>(non_ascii, 3 * length)); |
873 CHECK_EQ(length, non_ascii_sym->length()); | 874 CHECK_EQ(length, non_ascii_sym->length()); |
874 Handle<String> ascii_sym = | 875 Handle<String> ascii_sym = |
875 factory->InternalizeOneByteString(OneByteVector(ascii, length)); | 876 factory->InternalizeOneByteString(OneByteVector(ascii, length)); |
876 CHECK_EQ(length, ascii_sym->length()); | 877 CHECK_EQ(length, ascii_sym->length()); |
877 Handle<String> non_ascii_str = | 878 Handle<String> non_ascii_str = factory->NewStringFromUtf8( |
878 factory->NewStringFromUtf8(Vector<const char>(non_ascii, 3 * length)); | 879 Vector<const char>(non_ascii, 3 * length)).ToHandleChecked(); |
879 non_ascii_str->Hash(); | 880 non_ascii_str->Hash(); |
880 CHECK_EQ(length, non_ascii_str->length()); | 881 CHECK_EQ(length, non_ascii_str->length()); |
881 Handle<String> ascii_str = | 882 Handle<String> ascii_str = factory->NewStringFromUtf8( |
882 factory->NewStringFromUtf8(Vector<const char>(ascii, length)); | 883 Vector<const char>(ascii, length)).ToHandleChecked(); |
883 ascii_str->Hash(); | 884 ascii_str->Hash(); |
884 CHECK_EQ(length, ascii_str->length()); | 885 CHECK_EQ(length, ascii_str->length()); |
885 DeleteArray(non_ascii); | 886 DeleteArray(non_ascii); |
886 DeleteArray(ascii); | 887 DeleteArray(ascii); |
887 } | 888 } |
888 } | 889 } |
889 | 890 |
890 | 891 |
891 static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) { | 892 static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) { |
892 // Count the number of objects found in the heap. | 893 // Count the number of objects found in the heap. |
(...skipping 23 matching lines...) Expand all Loading... |
916 int next_objs_index = 0; | 917 int next_objs_index = 0; |
917 | 918 |
918 // Allocate a JS array to OLD_POINTER_SPACE and NEW_SPACE | 919 // Allocate a JS array to OLD_POINTER_SPACE and NEW_SPACE |
919 objs[next_objs_index++] = factory->NewJSArray(10); | 920 objs[next_objs_index++] = factory->NewJSArray(10); |
920 objs[next_objs_index++] = factory->NewJSArray(10, | 921 objs[next_objs_index++] = factory->NewJSArray(10, |
921 FAST_HOLEY_ELEMENTS, | 922 FAST_HOLEY_ELEMENTS, |
922 TENURED); | 923 TENURED); |
923 | 924 |
924 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE | 925 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE |
925 objs[next_objs_index++] = | 926 objs[next_objs_index++] = |
926 factory->NewStringFromAscii(CStrVector("abcdefghij")); | 927 factory->NewStringFromStaticAscii("abcdefghij"); |
927 objs[next_objs_index++] = | 928 objs[next_objs_index++] = |
928 factory->NewStringFromAscii(CStrVector("abcdefghij"), TENURED); | 929 factory->NewStringFromStaticAscii("abcdefghij", TENURED); |
929 | 930 |
930 // Allocate a large string (for large object space). | 931 // Allocate a large string (for large object space). |
931 int large_size = Page::kMaxRegularHeapObjectSize + 1; | 932 int large_size = Page::kMaxRegularHeapObjectSize + 1; |
932 char* str = new char[large_size]; | 933 char* str = new char[large_size]; |
933 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; | 934 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; |
934 str[large_size - 1] = '\0'; | 935 str[large_size - 1] = '\0'; |
935 objs[next_objs_index++] = | 936 objs[next_objs_index++] = factory->NewStringFromAsciiChecked(str, TENURED); |
936 factory->NewStringFromAscii(CStrVector(str), TENURED); | |
937 delete[] str; | 937 delete[] str; |
938 | 938 |
939 // Add a Map object to look for. | 939 // Add a Map object to look for. |
940 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); | 940 objs[next_objs_index++] = Handle<Map>(HeapObject::cast(*objs[0])->map()); |
941 | 941 |
942 CHECK_EQ(objs_count, next_objs_index); | 942 CHECK_EQ(objs_count, next_objs_index); |
943 CHECK_EQ(objs_count, ObjectsFoundInHeap(CcTest::heap(), objs, objs_count)); | 943 CHECK_EQ(objs_count, ObjectsFoundInHeap(CcTest::heap(), objs, objs_count)); |
944 } | 944 } |
945 | 945 |
946 | 946 |
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2938 CcTest::InitializeVM(); | 2938 CcTest::InitializeVM(); |
2939 Isolate* isolate = CcTest::i_isolate(); | 2939 Isolate* isolate = CcTest::i_isolate(); |
2940 Factory* factory = isolate->factory(); | 2940 Factory* factory = isolate->factory(); |
2941 v8::HandleScope scope(CcTest::isolate()); | 2941 v8::HandleScope scope(CcTest::isolate()); |
2942 Handle<String> slice(CcTest::heap()->empty_string()); | 2942 Handle<String> slice(CcTest::heap()->empty_string()); |
2943 | 2943 |
2944 { | 2944 { |
2945 // Generate a parent that lives in new-space. | 2945 // Generate a parent that lives in new-space. |
2946 v8::HandleScope inner_scope(CcTest::isolate()); | 2946 v8::HandleScope inner_scope(CcTest::isolate()); |
2947 const char* c = "This text is long enough to trigger sliced strings."; | 2947 const char* c = "This text is long enough to trigger sliced strings."; |
2948 Handle<String> s = factory->NewStringFromAscii(CStrVector(c)); | 2948 Handle<String> s = factory->NewStringFromAsciiChecked(c); |
2949 CHECK(s->IsSeqOneByteString()); | 2949 CHECK(s->IsSeqOneByteString()); |
2950 CHECK(CcTest::heap()->InNewSpace(*s)); | 2950 CHECK(CcTest::heap()->InNewSpace(*s)); |
2951 | 2951 |
2952 // Generate a sliced string that is based on the above parent and | 2952 // Generate a sliced string that is based on the above parent and |
2953 // lives in old-space. | 2953 // lives in old-space. |
2954 SimulateFullSpace(CcTest::heap()->new_space()); | 2954 SimulateFullSpace(CcTest::heap()->new_space()); |
2955 AlwaysAllocateScope always_allocate(isolate); | 2955 AlwaysAllocateScope always_allocate(isolate); |
2956 Handle<String> t = factory->NewProperSubString(s, 5, 35); | 2956 Handle<String> t = factory->NewProperSubString(s, 5, 35); |
2957 CHECK(t->IsSlicedString()); | 2957 CHECK(t->IsSlicedString()); |
2958 CHECK(!CcTest::heap()->InNewSpace(*t)); | 2958 CHECK(!CcTest::heap()->InNewSpace(*t)); |
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4182 v8::Context::Scope cscope(context); | 4182 v8::Context::Scope cscope(context); |
4183 | 4183 |
4184 v8::Local<v8::Value> result = CompileRun( | 4184 v8::Local<v8::Value> result = CompileRun( |
4185 "var locals = '';" | 4185 "var locals = '';" |
4186 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';" | 4186 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';" |
4187 "eval('function f() {' + locals + 'return function() { return v0; }; }');" | 4187 "eval('function f() {' + locals + 'return function() { return v0; }; }');" |
4188 "interrupt();" // This triggers a fake stack overflow in f. | 4188 "interrupt();" // This triggers a fake stack overflow in f. |
4189 "f()()"); | 4189 "f()()"); |
4190 CHECK_EQ(42.0, result->ToNumber()->Value()); | 4190 CHECK_EQ(42.0, result->ToNumber()->Value()); |
4191 } | 4191 } |
OLD | NEW |