| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 // nan oddball checks | 193 // nan oddball checks |
| 194 CHECK(factory->nan_value()->IsNumber()); | 194 CHECK(factory->nan_value()->IsNumber()); |
| 195 CHECK(std::isnan(factory->nan_value()->Number())); | 195 CHECK(std::isnan(factory->nan_value()->Number())); |
| 196 | 196 |
| 197 Handle<String> s = factory->NewStringFromStaticChars("fisk hest "); | 197 Handle<String> s = factory->NewStringFromStaticChars("fisk hest "); |
| 198 CHECK(s->IsString()); | 198 CHECK(s->IsString()); |
| 199 CHECK_EQ(10, s->length()); | 199 CHECK_EQ(10, s->length()); |
| 200 | 200 |
| 201 Handle<String> object_string = Handle<String>::cast(factory->Object_string()); | 201 Handle<String> object_string = Handle<String>::cast(factory->Object_string()); |
| 202 Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object()); | 202 Handle<JSGlobalObject> global( |
| 203 CcTest::i_isolate()->context()->global_object()); |
| 203 CHECK(Just(true) == JSReceiver::HasOwnProperty(global, object_string)); | 204 CHECK(Just(true) == JSReceiver::HasOwnProperty(global, object_string)); |
| 204 | 205 |
| 205 // Check ToString for oddballs | 206 // Check ToString for oddballs |
| 206 CheckOddball(isolate, heap->true_value(), "true"); | 207 CheckOddball(isolate, heap->true_value(), "true"); |
| 207 CheckOddball(isolate, heap->false_value(), "false"); | 208 CheckOddball(isolate, heap->false_value(), "false"); |
| 208 CheckOddball(isolate, heap->null_value(), "null"); | 209 CheckOddball(isolate, heap->null_value(), "null"); |
| 209 CheckOddball(isolate, heap->undefined_value(), "undefined"); | 210 CheckOddball(isolate, heap->undefined_value(), "undefined"); |
| 210 | 211 |
| 211 // Check ToString for Smis | 212 // Check ToString for Smis |
| 212 CheckSmi(isolate, 0, "0"); | 213 CheckSmi(isolate, 0, "0"); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 TEST(GarbageCollection) { | 433 TEST(GarbageCollection) { |
| 433 CcTest::InitializeVM(); | 434 CcTest::InitializeVM(); |
| 434 Isolate* isolate = CcTest::i_isolate(); | 435 Isolate* isolate = CcTest::i_isolate(); |
| 435 Heap* heap = isolate->heap(); | 436 Heap* heap = isolate->heap(); |
| 436 Factory* factory = isolate->factory(); | 437 Factory* factory = isolate->factory(); |
| 437 | 438 |
| 438 HandleScope sc(isolate); | 439 HandleScope sc(isolate); |
| 439 // Check GC. | 440 // Check GC. |
| 440 heap->CollectGarbage(NEW_SPACE); | 441 heap->CollectGarbage(NEW_SPACE); |
| 441 | 442 |
| 442 Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object()); | 443 Handle<JSGlobalObject> global( |
| 444 CcTest::i_isolate()->context()->global_object()); |
| 443 Handle<String> name = factory->InternalizeUtf8String("theFunction"); | 445 Handle<String> name = factory->InternalizeUtf8String("theFunction"); |
| 444 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); | 446 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); |
| 445 Handle<String> prop_namex = factory->InternalizeUtf8String("theSlotx"); | 447 Handle<String> prop_namex = factory->InternalizeUtf8String("theSlotx"); |
| 446 Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); | 448 Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); |
| 447 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); | 449 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); |
| 448 Handle<Smi> twenty_four(Smi::FromInt(24), isolate); | 450 Handle<Smi> twenty_four(Smi::FromInt(24), isolate); |
| 449 | 451 |
| 450 { | 452 { |
| 451 HandleScope inner_scope(isolate); | 453 HandleScope inner_scope(isolate); |
| 452 // Allocate a function and keep it in global object's property. | 454 // Allocate a function and keep it in global object's property. |
| (...skipping 1894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2347 heap->CollectAllAvailableGarbage(); | 2349 heap->CollectAllAvailableGarbage(); |
| 2348 new_capacity = new_space->TotalCapacity(); | 2350 new_capacity = new_space->TotalCapacity(); |
| 2349 CHECK(old_capacity == new_capacity); | 2351 CHECK(old_capacity == new_capacity); |
| 2350 } | 2352 } |
| 2351 | 2353 |
| 2352 | 2354 |
| 2353 static int NumberOfGlobalObjects() { | 2355 static int NumberOfGlobalObjects() { |
| 2354 int count = 0; | 2356 int count = 0; |
| 2355 HeapIterator iterator(CcTest::heap()); | 2357 HeapIterator iterator(CcTest::heap()); |
| 2356 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 2358 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 2357 if (obj->IsGlobalObject()) count++; | 2359 if (obj->IsJSGlobalObject()) count++; |
| 2358 } | 2360 } |
| 2359 // Subtract two to compensate for the two global objects (not global | 2361 // Subtract two to compensate for the two global objects (not global |
| 2360 // JSObjects, of which there would only be one) that are part of the code stub | 2362 // JSObjects, of which there would only be one) that are part of the code stub |
| 2361 // context, which is always present. | 2363 // context, which is always present. |
| 2362 return count - 2; | 2364 return count - 2; |
| 2363 } | 2365 } |
| 2364 | 2366 |
| 2365 | 2367 |
| 2366 // Test that we don't embed maps from foreign contexts into | 2368 // Test that we don't embed maps from foreign contexts into |
| 2367 // optimized code. | 2369 // optimized code. |
| (...skipping 3215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5583 } | 5585 } |
| 5584 | 5586 |
| 5585 | 5587 |
| 5586 TEST(Regress442710) { | 5588 TEST(Regress442710) { |
| 5587 CcTest::InitializeVM(); | 5589 CcTest::InitializeVM(); |
| 5588 Isolate* isolate = CcTest::i_isolate(); | 5590 Isolate* isolate = CcTest::i_isolate(); |
| 5589 Heap* heap = isolate->heap(); | 5591 Heap* heap = isolate->heap(); |
| 5590 Factory* factory = isolate->factory(); | 5592 Factory* factory = isolate->factory(); |
| 5591 | 5593 |
| 5592 HandleScope sc(isolate); | 5594 HandleScope sc(isolate); |
| 5593 Handle<GlobalObject> global(CcTest::i_isolate()->context()->global_object()); | 5595 Handle<JSGlobalObject> global( |
| 5596 CcTest::i_isolate()->context()->global_object()); |
| 5594 Handle<JSArray> array = factory->NewJSArray(2); | 5597 Handle<JSArray> array = factory->NewJSArray(2); |
| 5595 | 5598 |
| 5596 Handle<String> name = factory->InternalizeUtf8String("testArray"); | 5599 Handle<String> name = factory->InternalizeUtf8String("testArray"); |
| 5597 JSReceiver::SetProperty(global, name, array, SLOPPY).Check(); | 5600 JSReceiver::SetProperty(global, name, array, SLOPPY).Check(); |
| 5598 CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();"); | 5601 CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();"); |
| 5599 heap->CollectGarbage(OLD_SPACE); | 5602 heap->CollectGarbage(OLD_SPACE); |
| 5600 } | 5603 } |
| 5601 | 5604 |
| 5602 | 5605 |
| 5603 HEAP_TEST(NumberStringCacheSize) { | 5606 HEAP_TEST(NumberStringCacheSize) { |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6280 isolate->IncrementJsCallsFromApiCounter(); | 6283 isolate->IncrementJsCallsFromApiCounter(); |
| 6281 isolate->IncrementJsCallsFromApiCounter(); | 6284 isolate->IncrementJsCallsFromApiCounter(); |
| 6282 isolate->IncrementJsCallsFromApiCounter(); | 6285 isolate->IncrementJsCallsFromApiCounter(); |
| 6283 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); | 6286 calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); |
| 6284 CheckDoubleEquals(2, calls_per_ms); | 6287 CheckDoubleEquals(2, calls_per_ms); |
| 6285 } | 6288 } |
| 6286 | 6289 |
| 6287 | 6290 |
| 6288 } // namespace internal | 6291 } // namespace internal |
| 6289 } // namespace v8 | 6292 } // namespace v8 |
| OLD | NEW |