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 5224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5235 object = v8::Persistent<v8::Object>::New(v8::Object::New()); | 5235 object = v8::Persistent<v8::Object>::New(v8::Object::New()); |
5236 object->Set(v8_str("x"), v8::Integer::New(1)); | 5236 object->Set(v8_str("x"), v8::Integer::New(1)); |
5237 v8::Local<String> y_str = v8_str("y"); | 5237 v8::Local<String> y_str = v8_str("y"); |
5238 object->Set(y_str, y_str); | 5238 object->Set(y_str, y_str); |
5239 } | 5239 } |
5240 bool revived = false; | 5240 bool revived = false; |
5241 object.MakeWeak(&revived, &RevivingCallback); | 5241 object.MakeWeak(&revived, &RevivingCallback); |
5242 object.MarkIndependent(); | 5242 object.MarkIndependent(); |
5243 HEAP->PerformScavenge(); | 5243 HEAP->PerformScavenge(); |
5244 CHECK(revived); | 5244 CHECK(revived); |
5245 HEAP->CollectAllGarbage(true); | 5245 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); |
5246 { | 5246 { |
5247 v8::HandleScope handle_scope; | 5247 v8::HandleScope handle_scope; |
5248 v8::Local<String> y_str = v8_str("y"); | 5248 v8::Local<String> y_str = v8_str("y"); |
5249 CHECK_EQ(v8::Integer::New(1), object->Get(v8_str("x"))); | 5249 CHECK_EQ(v8::Integer::New(1), object->Get(v8_str("x"))); |
5250 CHECK(object->Get(y_str)->Equals(y_str)); | 5250 CHECK(object->Get(y_str)->Equals(y_str)); |
5251 } | 5251 } |
5252 } | 5252 } |
5253 | 5253 |
5254 | 5254 |
5255 v8::Handle<Function> args_fun; | 5255 v8::Handle<Function> args_fun; |
(...skipping 4131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9387 "for (var i = 0; i < 1000; i++) {" | 9387 "for (var i = 0; i < 1000; i++) {" |
9388 " garbage = [1/i, \"garbage\" + i, garbage, {foo: garbage}];" | 9388 " garbage = [1/i, \"garbage\" + i, garbage, {foo: garbage}];" |
9389 "}" | 9389 "}" |
9390 "garbage = undefined;"); | 9390 "garbage = undefined;"); |
9391 } | 9391 } |
9392 | 9392 |
9393 | 9393 |
9394 v8::Handle<v8::Value> DirectApiCallback(const v8::Arguments& args) { | 9394 v8::Handle<v8::Value> DirectApiCallback(const v8::Arguments& args) { |
9395 static int count = 0; | 9395 static int count = 0; |
9396 if (count++ % 3 == 0) { | 9396 if (count++ % 3 == 0) { |
9397 HEAP-> CollectAllGarbage(true); // This should move the stub | 9397 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); |
| 9398 // This should move the stub |
9398 GenerateSomeGarbage(); // This should ensure the old stub memory is flushed | 9399 GenerateSomeGarbage(); // This should ensure the old stub memory is flushed |
9399 } | 9400 } |
9400 return v8::Handle<v8::Value>(); | 9401 return v8::Handle<v8::Value>(); |
9401 } | 9402 } |
9402 | 9403 |
9403 | 9404 |
9404 THREADED_TEST(CallICFastApi_DirectCall_GCMoveStub) { | 9405 THREADED_TEST(CallICFastApi_DirectCall_GCMoveStub) { |
9405 v8::HandleScope scope; | 9406 v8::HandleScope scope; |
9406 LocalContext context; | 9407 LocalContext context; |
9407 v8::Handle<v8::ObjectTemplate> nativeobject_templ = v8::ObjectTemplate::New(); | 9408 v8::Handle<v8::ObjectTemplate> nativeobject_templ = v8::ObjectTemplate::New(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9442 " }" | 9443 " }" |
9443 "}" | 9444 "}" |
9444 "f(); result;"); | 9445 "f(); result;"); |
9445 CHECK_EQ(v8_str("ggggg"), result); | 9446 CHECK_EQ(v8_str("ggggg"), result); |
9446 } | 9447 } |
9447 | 9448 |
9448 | 9449 |
9449 v8::Handle<v8::Value> DirectGetterCallback(Local<String> name, | 9450 v8::Handle<v8::Value> DirectGetterCallback(Local<String> name, |
9450 const v8::AccessorInfo& info) { | 9451 const v8::AccessorInfo& info) { |
9451 if (++p_getter_count % 3 == 0) { | 9452 if (++p_getter_count % 3 == 0) { |
9452 HEAP->CollectAllGarbage(true); | 9453 HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); |
9453 GenerateSomeGarbage(); | 9454 GenerateSomeGarbage(); |
9454 } | 9455 } |
9455 return v8::Handle<v8::Value>(); | 9456 return v8::Handle<v8::Value>(); |
9456 } | 9457 } |
9457 | 9458 |
9458 | 9459 |
9459 THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { | 9460 THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { |
9460 v8::HandleScope scope; | 9461 v8::HandleScope scope; |
9461 LocalContext context; | 9462 LocalContext context; |
9462 v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); | 9463 v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); |
(...skipping 6650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16113 CompileRun("({'a': 0})"); | 16114 CompileRun("({'a': 0})"); |
16114 } | 16115 } |
16115 | 16116 |
16116 int elements; | 16117 int elements; |
16117 { i::MapCache* map_cache = | 16118 { i::MapCache* map_cache = |
16118 i::MapCache::cast(i::Isolate::Current()->context()->map_cache()); | 16119 i::MapCache::cast(i::Isolate::Current()->context()->map_cache()); |
16119 elements = map_cache->NumberOfElements(); | 16120 elements = map_cache->NumberOfElements(); |
16120 CHECK_LE(1, elements); | 16121 CHECK_LE(1, elements); |
16121 } | 16122 } |
16122 | 16123 |
16123 i::Isolate::Current()->heap()->CollectAllGarbage(true); | 16124 i::Isolate::Current()->heap()->CollectAllGarbage( |
| 16125 i::Heap::kAbortIncrementalMarkingMask); |
16124 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); | 16126 { i::Object* raw_map_cache = i::Isolate::Current()->context()->map_cache(); |
16125 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { | 16127 if (raw_map_cache != i::Isolate::Current()->heap()->undefined_value()) { |
16126 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); | 16128 i::MapCache* map_cache = i::MapCache::cast(raw_map_cache); |
16127 CHECK_GT(elements, map_cache->NumberOfElements()); | 16129 CHECK_GT(elements, map_cache->NumberOfElements()); |
16128 } | 16130 } |
16129 } | 16131 } |
16130 } | 16132 } |
16131 | 16133 |
16132 | 16134 |
16133 static bool BlockProtoNamedSecurityTestCallback(Local<v8::Object> global, | 16135 static bool BlockProtoNamedSecurityTestCallback(Local<v8::Object> global, |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16828 " x++; \n" | 16830 " x++; \n" |
16829 " throw new Error('again'); \n" // This is the new uncaught error. | 16831 " throw new Error('again'); \n" // This is the new uncaught error. |
16830 "} \n"; | 16832 "} \n"; |
16831 CompileRun(throw_again); | 16833 CompileRun(throw_again); |
16832 CHECK(try_catch.HasCaught()); | 16834 CHECK(try_catch.HasCaught()); |
16833 Local<Message> message = try_catch.Message(); | 16835 Local<Message> message = try_catch.Message(); |
16834 CHECK(!message.IsEmpty()); | 16836 CHECK(!message.IsEmpty()); |
16835 CHECK_EQ(6, message->GetLineNumber()); | 16837 CHECK_EQ(6, message->GetLineNumber()); |
16836 } | 16838 } |
16837 } | 16839 } |
OLD | NEW |