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

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

Issue 82553005: Rollback of r18001 in bleeding_edge branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 1 month 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 | « src/heap.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 17170 matching lines...) Expand 10 before | Expand all | Expand 10 after
17181 CHECK(string1->IsExternal()); 17181 CHECK(string1->IsExternal());
17182 CHECK(string2->IsExternal()); 17182 CHECK(string2->IsExternal());
17183 CHECK(string3->IsExternal()); 17183 CHECK(string3->IsExternal());
17184 17184
17185 VisitorImpl visitor(resource); 17185 VisitorImpl visitor(resource);
17186 v8::V8::VisitExternalResources(&visitor); 17186 v8::V8::VisitExternalResources(&visitor);
17187 visitor.CheckVisitedResources(); 17187 visitor.CheckVisitedResources();
17188 } 17188 }
17189 17189
17190 17190
17191 TEST(ExternalStringCollectedAtTearDown) {
17192 int destroyed = 0;
17193 v8::Isolate* isolate = v8::Isolate::New();
17194 { v8::Isolate::Scope isolate_scope(isolate);
17195 v8::HandleScope handle_scope(isolate);
17196 const char* s = "One string to test them all, one string to find them.";
17197 TestAsciiResource* inscription =
17198 new TestAsciiResource(i::StrDup(s), &destroyed);
17199 v8::Local<v8::String> ring = v8::String::NewExternal(inscription);
17200 // Ring is still alive. Orcs are roaming freely across our lands.
17201 CHECK_EQ(0, destroyed);
17202 USE(ring);
17203 }
17204
17205 isolate->Dispose();
17206 // Ring has been destroyed. Free Peoples of Middle-earth Rejoice.
17207 CHECK_EQ(1, destroyed);
17208 }
17209
17210
17211 static double DoubleFromBits(uint64_t value) { 17191 static double DoubleFromBits(uint64_t value) {
17212 double target; 17192 double target;
17213 i::OS::MemCopy(&target, &value, sizeof(target)); 17193 i::OS::MemCopy(&target, &value, sizeof(target));
17214 return target; 17194 return target;
17215 } 17195 }
17216 17196
17217 17197
17218 static uint64_t DoubleToBits(double value) { 17198 static uint64_t DoubleToBits(double value) {
17219 uint64_t target; 17199 uint64_t target;
17220 i::OS::MemCopy(&target, &value, sizeof(target)); 17200 i::OS::MemCopy(&target, &value, sizeof(target));
(...skipping 3510 matching lines...) Expand 10 before | Expand all | Expand 10 after
20731 } 20711 }
20732 for (int i = 0; i < runs; i++) { 20712 for (int i = 0; i < runs; i++) {
20733 Local<String> expected; 20713 Local<String> expected;
20734 if (i != 0) { 20714 if (i != 0) {
20735 CHECK_EQ(v8_str("escape value"), values[i]); 20715 CHECK_EQ(v8_str("escape value"), values[i]);
20736 } else { 20716 } else {
20737 CHECK(values[i].IsEmpty()); 20717 CHECK(values[i].IsEmpty());
20738 } 20718 }
20739 } 20719 }
20740 } 20720 }
OLDNEW
« no previous file with comments | « src/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698