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

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

Issue 249103002: StringTable::LookupKey() and all callers handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review notes Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-api.cc ('k') | 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 "var", 589 "var",
590 "void", 590 "void",
591 "volatile", 591 "volatile",
592 "while", 592 "while",
593 "with", 593 "with",
594 0 594 0
595 }; 595 };
596 596
597 597
598 static void CheckInternalizedStrings(const char** strings) { 598 static void CheckInternalizedStrings(const char** strings) {
599 Factory* factory = CcTest::i_isolate()->factory();
599 for (const char* string = *strings; *strings != 0; string = *strings++) { 600 for (const char* string = *strings; *strings != 0; string = *strings++) {
600 Object* a; 601 Handle<String> a = factory->InternalizeUtf8String(string);
601 MaybeObject* maybe_a = CcTest::heap()->InternalizeUtf8String(string);
602 // InternalizeUtf8String may return a failure if a GC is needed.
603 if (!maybe_a->ToObject(&a)) continue;
604 CHECK(a->IsInternalizedString()); 602 CHECK(a->IsInternalizedString());
605 Object* b; 603 Handle<String> b = factory->InternalizeUtf8String(string);
606 MaybeObject* maybe_b = CcTest::heap()->InternalizeUtf8String(string); 604 CHECK_EQ(*b, *a);
607 if (!maybe_b->ToObject(&b)) continue; 605 CHECK(String::cast(*b)->IsUtf8EqualTo(CStrVector(string)));
608 CHECK_EQ(b, a);
609 CHECK(String::cast(b)->IsUtf8EqualTo(CStrVector(string)));
610 } 606 }
611 } 607 }
612 608
613 609
614 TEST(StringTable) { 610 TEST(StringTable) {
615 CcTest::InitializeVM(); 611 CcTest::InitializeVM();
616 612
613 v8::HandleScope sc(CcTest::isolate());
617 CheckInternalizedStrings(not_so_random_string_table); 614 CheckInternalizedStrings(not_so_random_string_table);
618 CheckInternalizedStrings(not_so_random_string_table); 615 CheckInternalizedStrings(not_so_random_string_table);
619 } 616 }
620 617
621 618
622 TEST(FunctionAllocation) { 619 TEST(FunctionAllocation) {
623 CcTest::InitializeVM(); 620 CcTest::InitializeVM();
624 Isolate* isolate = CcTest::i_isolate(); 621 Isolate* isolate = CcTest::i_isolate();
625 Factory* factory = isolate->factory(); 622 Factory* factory = isolate->factory();
626 623
(...skipping 3567 matching lines...) Expand 10 before | Expand all | Expand 10 after
4194 v8::Context::Scope cscope(context); 4191 v8::Context::Scope cscope(context);
4195 4192
4196 v8::Local<v8::Value> result = CompileRun( 4193 v8::Local<v8::Value> result = CompileRun(
4197 "var locals = '';" 4194 "var locals = '';"
4198 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';" 4195 "for (var i = 0; i < 512; i++) locals += 'var v' + i + '= 42;';"
4199 "eval('function f() {' + locals + 'return function() { return v0; }; }');" 4196 "eval('function f() {' + locals + 'return function() { return v0; }; }');"
4200 "interrupt();" // This triggers a fake stack overflow in f. 4197 "interrupt();" // This triggers a fake stack overflow in f.
4201 "f()()"); 4198 "f()()");
4202 CHECK_EQ(42.0, result->ToNumber()->Value()); 4199 CHECK_EQ(42.0, result->ToNumber()->Value());
4203 } 4200 }
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698