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 27 matching lines...) Expand all Loading... |
38 #include <utility> | 38 #include <utility> |
39 | 39 |
40 #include "src/v8.h" | 40 #include "src/v8.h" |
41 | 41 |
42 #include "src/full-codegen.h" | 42 #include "src/full-codegen.h" |
43 #include "src/global-handles.h" | 43 #include "src/global-handles.h" |
44 #include "src/snapshot.h" | 44 #include "src/snapshot.h" |
45 #include "test/cctest/cctest.h" | 45 #include "test/cctest/cctest.h" |
46 | 46 |
47 using namespace v8::internal; | 47 using namespace v8::internal; |
| 48 using v8::Just; |
48 | 49 |
49 | 50 |
50 TEST(MarkingDeque) { | 51 TEST(MarkingDeque) { |
51 CcTest::InitializeVM(); | 52 CcTest::InitializeVM(); |
52 int mem_size = 20 * kPointerSize; | 53 int mem_size = 20 * kPointerSize; |
53 byte* mem = NewArray<byte>(20*kPointerSize); | 54 byte* mem = NewArray<byte>(20*kPointerSize); |
54 Address low = reinterpret_cast<Address>(mem); | 55 Address low = reinterpret_cast<Address>(mem); |
55 Address high = low + mem_size; | 56 Address high = low + mem_size; |
56 MarkingDeque s; | 57 MarkingDeque s; |
57 s.Initialize(low, high); | 58 s.Initialize(low, high); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 Handle<JSFunction> function = factory->NewFunction(func_name); | 161 Handle<JSFunction> function = factory->NewFunction(func_name); |
161 JSReceiver::SetProperty(global, func_name, function, SLOPPY).Check(); | 162 JSReceiver::SetProperty(global, func_name, function, SLOPPY).Check(); |
162 | 163 |
163 factory->NewJSObject(function); | 164 factory->NewJSObject(function); |
164 } | 165 } |
165 | 166 |
166 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 4"); | 167 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 4"); |
167 | 168 |
168 { HandleScope scope(isolate); | 169 { HandleScope scope(isolate); |
169 Handle<String> func_name = factory->InternalizeUtf8String("theFunction"); | 170 Handle<String> func_name = factory->InternalizeUtf8String("theFunction"); |
170 v8::Maybe<bool> maybe = JSReceiver::HasOwnProperty(global, func_name); | 171 CHECK(Just(true) == JSReceiver::HasOwnProperty(global, func_name)); |
171 CHECK(maybe.has_value); | |
172 CHECK(maybe.value); | |
173 Handle<Object> func_value = | 172 Handle<Object> func_value = |
174 Object::GetProperty(global, func_name).ToHandleChecked(); | 173 Object::GetProperty(global, func_name).ToHandleChecked(); |
175 CHECK(func_value->IsJSFunction()); | 174 CHECK(func_value->IsJSFunction()); |
176 Handle<JSFunction> function = Handle<JSFunction>::cast(func_value); | 175 Handle<JSFunction> function = Handle<JSFunction>::cast(func_value); |
177 Handle<JSObject> obj = factory->NewJSObject(function); | 176 Handle<JSObject> obj = factory->NewJSObject(function); |
178 | 177 |
179 Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); | 178 Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); |
180 JSReceiver::SetProperty(global, obj_name, obj, SLOPPY).Check(); | 179 JSReceiver::SetProperty(global, obj_name, obj, SLOPPY).Check(); |
181 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); | 180 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); |
182 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); | 181 Handle<Smi> twenty_three(Smi::FromInt(23), isolate); |
183 JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check(); | 182 JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check(); |
184 } | 183 } |
185 | 184 |
186 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 5"); | 185 heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 5"); |
187 | 186 |
188 { HandleScope scope(isolate); | 187 { HandleScope scope(isolate); |
189 Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); | 188 Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); |
190 v8::Maybe<bool> maybe = JSReceiver::HasOwnProperty(global, obj_name); | 189 CHECK(Just(true) == JSReceiver::HasOwnProperty(global, obj_name)); |
191 CHECK(maybe.has_value); | |
192 CHECK(maybe.value); | |
193 Handle<Object> object = | 190 Handle<Object> object = |
194 Object::GetProperty(global, obj_name).ToHandleChecked(); | 191 Object::GetProperty(global, obj_name).ToHandleChecked(); |
195 CHECK(object->IsJSObject()); | 192 CHECK(object->IsJSObject()); |
196 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); | 193 Handle<String> prop_name = factory->InternalizeUtf8String("theSlot"); |
197 CHECK_EQ(*Object::GetProperty(object, prop_name).ToHandleChecked(), | 194 CHECK_EQ(*Object::GetProperty(object, prop_name).ToHandleChecked(), |
198 Smi::FromInt(23)); | 195 Smi::FromInt(23)); |
199 } | 196 } |
200 } | 197 } |
201 | 198 |
202 | 199 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 | 483 |
487 | 484 |
488 TEST(RegressJoinThreadsOnIsolateDeinit) { | 485 TEST(RegressJoinThreadsOnIsolateDeinit) { |
489 intptr_t size_limit = ShortLivingIsolate() * 2; | 486 intptr_t size_limit = ShortLivingIsolate() * 2; |
490 for (int i = 0; i < 10; i++) { | 487 for (int i = 0; i < 10; i++) { |
491 CHECK_GT(size_limit, ShortLivingIsolate()); | 488 CHECK_GT(size_limit, ShortLivingIsolate()); |
492 } | 489 } |
493 } | 490 } |
494 | 491 |
495 #endif // __linux__ and !USE_SIMULATOR | 492 #endif // __linux__ and !USE_SIMULATOR |
OLD | NEW |