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

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

Issue 106863002: Fix compilation with clang (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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/x64/stub-cache-x64.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | 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 6436 matching lines...) Expand 10 before | Expand all | Expand 10 after
6447 " testBool();" 6447 " testBool();"
6448 "}\n" 6448 "}\n"
6449 "\"PASS\"", 6449 "\"PASS\"",
6450 "PASS"); 6450 "PASS");
6451 } 6451 }
6452 6452
6453 6453
6454 template <typename T> static void USE(T) { } 6454 template <typename T> static void USE(T) { }
6455 6455
6456 6456
6457 // This test is not intended to be run, just type checked. 6457 // The point of this test is type checking. We run it only so compilers
6458 static inline void PersistentHandles(v8::Isolate* isolate) { 6458 // don't complain about an unused function.
6459 USE(PersistentHandles); 6459 TEST(PersistentHandles) {
6460 LocalContext env;
6461 v8::Isolate* isolate = CcTest::isolate();
6462 v8::HandleScope scope(isolate);
6460 Local<String> str = v8_str("foo"); 6463 Local<String> str = v8_str("foo");
6461 v8::Persistent<String> p_str(isolate, str); 6464 v8::Persistent<String> p_str(isolate, str);
6462 p_str.Reset(); 6465 p_str.Reset();
6463 Local<Script> scr = Script::Compile(v8_str("")); 6466 Local<Script> scr = Script::Compile(v8_str(""));
6464 v8::Persistent<Script> p_scr(isolate, scr); 6467 v8::Persistent<Script> p_scr(isolate, scr);
6465 p_scr.Reset(); 6468 p_scr.Reset();
6466 Local<ObjectTemplate> templ = ObjectTemplate::New(); 6469 Local<ObjectTemplate> templ = ObjectTemplate::New();
6467 v8::Persistent<ObjectTemplate> p_templ(isolate, templ); 6470 v8::Persistent<ObjectTemplate> p_templ(isolate, templ);
6468 p_templ.Reset(); 6471 p_templ.Reset();
6469 } 6472 }
(...skipping 11611 matching lines...) Expand 10 before | Expand all | Expand 10 after
18081 " var r1_ = %_GetFromCache(0, key1);" 18084 " var r1_ = %_GetFromCache(0, key1);"
18082 " if (r1 !== r1_)" 18085 " if (r1 !== r1_)"
18083 " return 'Different results for ' + key1 + ': ' + r1 + ' vs. ' + r1_;" 18086 " return 'Different results for ' + key1 + ': ' + r1 + ' vs. ' + r1_;"
18084 " return 'PASSED';" 18087 " return 'PASSED';"
18085 "})()"; 18088 "})()";
18086 CcTest::heap()->ClearJSFunctionResultCaches(); 18089 CcTest::heap()->ClearJSFunctionResultCaches();
18087 ExpectString(code, "PASSED"); 18090 ExpectString(code, "PASSED");
18088 } 18091 }
18089 18092
18090 18093
18091 static const int k0CacheSize = 16;
18092
18093 THREADED_TEST(FillJSFunctionResultCache) { 18094 THREADED_TEST(FillJSFunctionResultCache) {
18094 i::FLAG_allow_natives_syntax = true; 18095 i::FLAG_allow_natives_syntax = true;
18095 LocalContext context; 18096 LocalContext context;
18096 v8::HandleScope scope(context->GetIsolate()); 18097 v8::HandleScope scope(context->GetIsolate());
18097 18098
18098 const char* code = 18099 const char* code =
18099 "(function() {" 18100 "(function() {"
18100 " var k = 'a';" 18101 " var k = 'a';"
18101 " var r = %_GetFromCache(0, k);" 18102 " var r = %_GetFromCache(0, k);"
18102 " for (var i = 0; i < 16; i++) {" 18103 " for (var i = 0; i < 16; i++) {"
(...skipping 2769 matching lines...) Expand 10 before | Expand all | Expand 10 after
20872 } 20873 }
20873 for (int i = 0; i < runs; i++) { 20874 for (int i = 0; i < runs; i++) {
20874 Local<String> expected; 20875 Local<String> expected;
20875 if (i != 0) { 20876 if (i != 0) {
20876 CHECK_EQ(v8_str("escape value"), values[i]); 20877 CHECK_EQ(v8_str("escape value"), values[i]);
20877 } else { 20878 } else {
20878 CHECK(values[i].IsEmpty()); 20879 CHECK(values[i].IsEmpty());
20879 } 20880 }
20880 } 20881 }
20881 } 20882 }
OLDNEW
« no previous file with comments | « src/x64/stub-cache-x64.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698