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 18 matching lines...) Expand all Loading... |
29 #include <utility> | 29 #include <utility> |
30 | 30 |
31 #include "src/v8.h" | 31 #include "src/v8.h" |
32 | 32 |
33 #include "src/compilation-cache.h" | 33 #include "src/compilation-cache.h" |
34 #include "src/execution.h" | 34 #include "src/execution.h" |
35 #include "src/factory.h" | 35 #include "src/factory.h" |
36 #include "src/global-handles.h" | 36 #include "src/global-handles.h" |
37 #include "src/ic/ic.h" | 37 #include "src/ic/ic.h" |
38 #include "src/macro-assembler.h" | 38 #include "src/macro-assembler.h" |
| 39 #include "src/snapshot.h" |
39 #include "test/cctest/cctest.h" | 40 #include "test/cctest/cctest.h" |
40 | 41 |
41 using namespace v8::internal; | 42 using namespace v8::internal; |
42 | 43 |
43 static void CheckMap(Map* map, int type, int instance_size) { | 44 static void CheckMap(Map* map, int type, int instance_size) { |
44 CHECK(map->IsHeapObject()); | 45 CHECK(map->IsHeapObject()); |
45 #ifdef DEBUG | 46 #ifdef DEBUG |
46 CHECK(CcTest::heap()->Contains(map)); | 47 CHECK(CcTest::heap()->Contains(map)); |
47 #endif | 48 #endif |
48 CHECK_EQ(CcTest::heap()->meta_map(), map->map()); | 49 CHECK_EQ(CcTest::heap()->meta_map(), map->map()); |
(...skipping 5034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5083 Handle<JSArray> array = factory->NewJSArray(2); | 5084 Handle<JSArray> array = factory->NewJSArray(2); |
5084 | 5085 |
5085 Handle<String> name = factory->InternalizeUtf8String("testArray"); | 5086 Handle<String> name = factory->InternalizeUtf8String("testArray"); |
5086 JSReceiver::SetProperty(global, name, array, SLOPPY).Check(); | 5087 JSReceiver::SetProperty(global, name, array, SLOPPY).Check(); |
5087 CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();"); | 5088 CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();"); |
5088 heap->CollectGarbage(OLD_POINTER_SPACE); | 5089 heap->CollectGarbage(OLD_POINTER_SPACE); |
5089 } | 5090 } |
5090 | 5091 |
5091 | 5092 |
5092 TEST(NumberStringCacheSize) { | 5093 TEST(NumberStringCacheSize) { |
| 5094 if (!Snapshot::HaveASnapshotToStartFrom()) return; |
| 5095 // Test that the number-string cache has not been resized in the snapshot. |
5093 CcTest::InitializeVM(); | 5096 CcTest::InitializeVM(); |
5094 Isolate* isolate = CcTest::i_isolate(); | 5097 Isolate* isolate = CcTest::i_isolate(); |
5095 Heap* heap = isolate->heap(); | 5098 Heap* heap = isolate->heap(); |
5096 // Test that the number-string cache has not been resized. | |
5097 CHECK_EQ(TestHeap::kInitialNumberStringCacheSize * 2, | 5099 CHECK_EQ(TestHeap::kInitialNumberStringCacheSize * 2, |
5098 heap->number_string_cache()->length()); | 5100 heap->number_string_cache()->length()); |
5099 } | 5101 } |
5100 | 5102 |
5101 | 5103 |
5102 #ifdef DEBUG | 5104 #ifdef DEBUG |
5103 TEST(PathTracer) { | 5105 TEST(PathTracer) { |
5104 CcTest::InitializeVM(); | 5106 CcTest::InitializeVM(); |
5105 v8::HandleScope scope(CcTest::isolate()); | 5107 v8::HandleScope scope(CcTest::isolate()); |
5106 | 5108 |
5107 v8::Local<v8::Value> result = CompileRun("'abc'"); | 5109 v8::Local<v8::Value> result = CompileRun("'abc'"); |
5108 Handle<Object> o = v8::Utils::OpenHandle(*result); | 5110 Handle<Object> o = v8::Utils::OpenHandle(*result); |
5109 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 5111 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
5110 } | 5112 } |
5111 #endif // DEBUG | 5113 #endif // DEBUG |
OLD | NEW |