Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1413)

Side by Side Diff: test/cctest/heap/test-heap.cc

Issue 2671703002: Add test to check for initial objects. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 VerifyStoredPrototypeMap(isolate, 102 VerifyStoredPrototypeMap(isolate,
103 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX, 103 Context::STRING_FUNCTION_PROTOTYPE_MAP_INDEX,
104 Context::STRING_FUNCTION_INDEX); 104 Context::STRING_FUNCTION_INDEX);
105 VerifyStoredPrototypeMap(isolate, Context::REGEXP_PROTOTYPE_MAP_INDEX, 105 VerifyStoredPrototypeMap(isolate, Context::REGEXP_PROTOTYPE_MAP_INDEX,
106 Context::REGEXP_FUNCTION_INDEX); 106 Context::REGEXP_FUNCTION_INDEX);
107 VerifyStoredPrototypeMap(isolate, Context::PROMISE_PROTOTYPE_MAP_INDEX, 107 VerifyStoredPrototypeMap(isolate, Context::PROMISE_PROTOTYPE_MAP_INDEX,
108 Context::PROMISE_FUNCTION_INDEX); 108 Context::PROMISE_FUNCTION_INDEX);
109 } 109 }
110 110
111 TEST(InitialObjects) {
112 LocalContext env;
113 HandleScope scope(CcTest::i_isolate());
114 Handle<Context> context = v8::Utils::OpenHandle(*env);
115 // Initial ArrayIterator prototype.
116 CHECK_EQ(
117 context->initial_array_iterator_prototype(),
118 *v8::Utils::OpenHandle(*CompileRun("[][Symbol.iterator]().__proto__")));
119 // Initial ArrayIterator prototype map.
120 CHECK_EQ(context->initial_array_iterator_prototype_map(),
121 context->initial_array_iterator_prototype()->map());
122 // Initial Array prototype.
123 CHECK_EQ(context->initial_array_prototype(),
124 *v8::Utils::OpenHandle(*CompileRun("Array.prototype")));
125 // Initial Generator prototype.
126 CHECK_EQ(context->initial_generator_prototype(),
127 *v8::Utils::OpenHandle(
128 *CompileRun("(function*(){}).__proto__.prototype")));
129 // Initial Iterator prototype.
130 CHECK_EQ(context->initial_iterator_prototype(),
131 *v8::Utils::OpenHandle(
132 *CompileRun("[][Symbol.iterator]().__proto__.__proto__")));
133 // Initial Object prototype.
134 CHECK_EQ(context->initial_object_prototype(),
135 *v8::Utils::OpenHandle(*CompileRun("Object.prototype")));
136 }
137
111 static void CheckOddball(Isolate* isolate, Object* obj, const char* string) { 138 static void CheckOddball(Isolate* isolate, Object* obj, const char* string) {
112 CHECK(obj->IsOddball()); 139 CHECK(obj->IsOddball());
113 Handle<Object> handle(obj, isolate); 140 Handle<Object> handle(obj, isolate);
114 Object* print_string = *Object::ToString(isolate, handle).ToHandleChecked(); 141 Object* print_string = *Object::ToString(isolate, handle).ToHandleChecked();
115 CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string))); 142 CHECK(String::cast(print_string)->IsUtf8EqualTo(CStrVector(string)));
116 } 143 }
117 144
118 145
119 static void CheckSmi(Isolate* isolate, int value, const char* string) { 146 static void CheckSmi(Isolate* isolate, int value, const char* string) {
120 Handle<Object> handle(Smi::FromInt(value), isolate); 147 Handle<Object> handle(Smi::FromInt(value), isolate);
(...skipping 7004 matching lines...) Expand 10 before | Expand all | Expand 10 after
7125 CHECK(!heap->code_space()->FirstPage()->Contains(code->address())); 7152 CHECK(!heap->code_space()->FirstPage()->Contains(code->address()));
7126 7153
7127 // Ensure it's not in large object space. 7154 // Ensure it's not in large object space.
7128 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address()); 7155 MemoryChunk* chunk = MemoryChunk::FromAddress(code->address());
7129 CHECK(chunk->owner()->identity() != LO_SPACE); 7156 CHECK(chunk->owner()->identity() != LO_SPACE);
7130 CHECK(chunk->NeverEvacuate()); 7157 CHECK(chunk->NeverEvacuate());
7131 } 7158 }
7132 7159
7133 } // namespace internal 7160 } // namespace internal
7134 } // namespace v8 7161 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698