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

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

Issue 866413002: Always adjust amount of external memory when change is reported. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « include/v8.h ('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 15181 matching lines...) Expand 10 before | Expand all | Expand 10 after
15192 v8::Isolate* isolate = CcTest::isolate(); 15192 v8::Isolate* isolate = CcTest::isolate();
15193 v8::HandleScope outer(isolate); 15193 v8::HandleScope outer(isolate);
15194 v8::Local<Context> env(Context::New(isolate)); 15194 v8::Local<Context> env(Context::New(isolate));
15195 CHECK(!env.IsEmpty()); 15195 CHECK(!env.IsEmpty());
15196 const int64_t kSize = 1024*1024; 15196 const int64_t kSize = 1024*1024;
15197 int64_t baseline = isolate->AdjustAmountOfExternalAllocatedMemory(0); 15197 int64_t baseline = isolate->AdjustAmountOfExternalAllocatedMemory(0);
15198 CHECK_EQ(baseline + kSize, 15198 CHECK_EQ(baseline + kSize,
15199 isolate->AdjustAmountOfExternalAllocatedMemory(kSize)); 15199 isolate->AdjustAmountOfExternalAllocatedMemory(kSize));
15200 CHECK_EQ(baseline, 15200 CHECK_EQ(baseline,
15201 isolate->AdjustAmountOfExternalAllocatedMemory(-kSize)); 15201 isolate->AdjustAmountOfExternalAllocatedMemory(-kSize));
15202 const int64_t kTriggerGCSize =
15203 v8::internal::Internals::kExternalAllocationLimit + 1;
15204 CHECK_EQ(baseline + kTriggerGCSize,
15205 isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize));
15206 CHECK_EQ(baseline,
15207 isolate->AdjustAmountOfExternalAllocatedMemory(-kTriggerGCSize));
15202 } 15208 }
15203 15209
15204 15210
15205 // Regression test for issue 54, object templates with internal fields 15211 // Regression test for issue 54, object templates with internal fields
15206 // but no accessors or interceptors did not get their internal field 15212 // but no accessors or interceptors did not get their internal field
15207 // count set on instances. 15213 // count set on instances.
15208 THREADED_TEST(Regress54) { 15214 THREADED_TEST(Regress54) {
15209 LocalContext context; 15215 LocalContext context;
15210 v8::Isolate* isolate = context->GetIsolate(); 15216 v8::Isolate* isolate = context->GetIsolate();
15211 v8::HandleScope outer(isolate); 15217 v8::HandleScope outer(isolate);
(...skipping 9504 matching lines...) Expand 10 before | Expand all | Expand 10 after
24716 "bar2.js"); 24722 "bar2.js");
24717 } 24723 }
24718 24724
24719 24725
24720 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) { 24726 TEST(StreamingScriptWithSourceMappingURLInTheMiddle) {
24721 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#", 24727 const char* chunks[] = {"function foo() { ret", "urn 13; }\n//#",
24722 " sourceMappingURL=bar2.js\n", "foo();", NULL}; 24728 " sourceMappingURL=bar2.js\n", "foo();", NULL};
24723 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL, 24729 RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, true, NULL,
24724 "bar2.js"); 24730 "bar2.js");
24725 } 24731 }
OLDNEW
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698