OLD | NEW |
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 return &local_counters[hash]; | 71 return &local_counters[hash]; |
72 } | 72 } |
73 if (local_counter_names[hash] == 0) { | 73 if (local_counter_names[hash] == 0) { |
74 local_counter_names[hash] = name; | 74 local_counter_names[hash] = name; |
75 return &local_counters[hash]; | 75 return &local_counters[hash]; |
76 } | 76 } |
77 if (strcmp(local_counter_names[hash], name) == 0) { | 77 if (strcmp(local_counter_names[hash], name) == 0) { |
78 return &local_counters[hash]; | 78 return &local_counters[hash]; |
79 } | 79 } |
80 hash = (hash + 1) % kCounters; | 80 hash = (hash + 1) % kCounters; |
81 ASSERT(hash != original_hash); // Hash table has been filled up. | 81 DCHECK(hash != original_hash); // Hash table has been filled up. |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 template <class T> | 86 template <class T> |
87 static Address AddressOf(T id) { | 87 static Address AddressOf(T id) { |
88 return ExternalReference(id, CcTest::i_isolate()).address(); | 88 return ExternalReference(id, CcTest::i_isolate()).address(); |
89 } | 89 } |
90 | 90 |
91 | 91 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 CcTest::i_isolate()->enable_serializer(); | 426 CcTest::i_isolate()->enable_serializer(); |
427 v8::V8::Initialize(); | 427 v8::V8::Initialize(); |
428 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 428 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
429 Heap* heap = isolate->heap(); | 429 Heap* heap = isolate->heap(); |
430 | 430 |
431 v8::Persistent<v8::Context> env; | 431 v8::Persistent<v8::Context> env; |
432 { | 432 { |
433 HandleScope scope(isolate); | 433 HandleScope scope(isolate); |
434 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); | 434 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); |
435 } | 435 } |
436 ASSERT(!env.IsEmpty()); | 436 DCHECK(!env.IsEmpty()); |
437 { | 437 { |
438 v8::HandleScope handle_scope(v8_isolate); | 438 v8::HandleScope handle_scope(v8_isolate); |
439 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); | 439 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); |
440 } | 440 } |
441 // Make sure all builtin scripts are cached. | 441 // Make sure all builtin scripts are cached. |
442 { HandleScope scope(isolate); | 442 { HandleScope scope(isolate); |
443 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 443 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
444 isolate->bootstrapper()->NativesSourceLookup(i); | 444 isolate->bootstrapper()->NativesSourceLookup(i); |
445 } | 445 } |
446 } | 446 } |
447 heap->CollectAllGarbage(Heap::kNoGCFlags); | 447 heap->CollectAllGarbage(Heap::kNoGCFlags); |
448 heap->CollectAllGarbage(Heap::kNoGCFlags); | 448 heap->CollectAllGarbage(Heap::kNoGCFlags); |
449 | 449 |
450 Object* raw_foo; | 450 Object* raw_foo; |
451 { | 451 { |
452 v8::HandleScope handle_scope(v8_isolate); | 452 v8::HandleScope handle_scope(v8_isolate); |
453 v8::Local<v8::String> foo = v8::String::NewFromUtf8(v8_isolate, "foo"); | 453 v8::Local<v8::String> foo = v8::String::NewFromUtf8(v8_isolate, "foo"); |
454 ASSERT(!foo.IsEmpty()); | 454 DCHECK(!foo.IsEmpty()); |
455 raw_foo = *(v8::Utils::OpenHandle(*foo)); | 455 raw_foo = *(v8::Utils::OpenHandle(*foo)); |
456 } | 456 } |
457 | 457 |
458 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; | 458 int file_name_length = StrLength(FLAG_testing_serialization_file) + 10; |
459 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); | 459 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); |
460 SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); | 460 SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); |
461 | 461 |
462 { | 462 { |
463 v8::HandleScope handle_scope(v8_isolate); | 463 v8::HandleScope handle_scope(v8_isolate); |
464 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); | 464 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 CcTest::i_isolate()->enable_serializer(); | 542 CcTest::i_isolate()->enable_serializer(); |
543 v8::V8::Initialize(); | 543 v8::V8::Initialize(); |
544 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 544 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
545 Heap* heap = isolate->heap(); | 545 Heap* heap = isolate->heap(); |
546 | 546 |
547 v8::Persistent<v8::Context> env; | 547 v8::Persistent<v8::Context> env; |
548 { | 548 { |
549 HandleScope scope(isolate); | 549 HandleScope scope(isolate); |
550 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); | 550 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); |
551 } | 551 } |
552 ASSERT(!env.IsEmpty()); | 552 DCHECK(!env.IsEmpty()); |
553 { | 553 { |
554 v8::HandleScope handle_scope(v8_isolate); | 554 v8::HandleScope handle_scope(v8_isolate); |
555 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); | 555 v8::Local<v8::Context>::New(v8_isolate, env)->Enter(); |
556 } | 556 } |
557 // Make sure all builtin scripts are cached. | 557 // Make sure all builtin scripts are cached. |
558 { HandleScope scope(isolate); | 558 { HandleScope scope(isolate); |
559 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { | 559 for (int i = 0; i < Natives::GetBuiltinsCount(); i++) { |
560 isolate->bootstrapper()->NativesSourceLookup(i); | 560 isolate->bootstrapper()->NativesSourceLookup(i); |
561 } | 561 } |
562 } | 562 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
837 { | 837 { |
838 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); | 838 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); |
839 script = v8::ScriptCompiler::CompileUnbound( | 839 script = v8::ScriptCompiler::CompileUnbound( |
840 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); | 840 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); |
841 } | 841 } |
842 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); | 842 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); |
843 CHECK(result->ToString()->Equals(v8_str("abcdef"))); | 843 CHECK(result->ToString()->Equals(v8_str("abcdef"))); |
844 } | 844 } |
845 isolate2->Dispose(); | 845 isolate2->Dispose(); |
846 } | 846 } |
OLD | NEW |