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

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

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-ast.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 29 matching lines...) Expand all
40 40
41 using namespace v8::internal; 41 using namespace v8::internal;
42 42
43 // --- P r i n t E x t e n s i o n --- 43 // --- P r i n t E x t e n s i o n ---
44 44
45 class PrintExtension : public v8::Extension { 45 class PrintExtension : public v8::Extension {
46 public: 46 public:
47 PrintExtension() : v8::Extension("v8/print", kSource) { } 47 PrintExtension() : v8::Extension("v8/print", kSource) { }
48 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( 48 virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
49 v8::Handle<v8::String> name); 49 v8::Handle<v8::String> name);
50 static v8::Handle<v8::Value> Print(const v8::Arguments& args); 50 static void Print(const v8::FunctionCallbackInfo<v8::Value>& args);
51 private: 51 private:
52 static const char* kSource; 52 static const char* kSource;
53 }; 53 };
54 54
55 55
56 const char* PrintExtension::kSource = "native function print();"; 56 const char* PrintExtension::kSource = "native function print();";
57 57
58 58
59 v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunction( 59 v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunction(
60 v8::Handle<v8::String> str) { 60 v8::Handle<v8::String> str) {
61 return v8::FunctionTemplate::New(PrintExtension::Print); 61 return v8::FunctionTemplate::New(PrintExtension::Print);
62 } 62 }
63 63
64 64
65 v8::Handle<v8::Value> PrintExtension::Print(const v8::Arguments& args) { 65 void PrintExtension::Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
66 for (int i = 0; i < args.Length(); i++) { 66 for (int i = 0; i < args.Length(); i++) {
67 if (i != 0) printf(" "); 67 if (i != 0) printf(" ");
68 v8::HandleScope scope(args.GetIsolate()); 68 v8::HandleScope scope(args.GetIsolate());
69 v8::String::Utf8Value str(args[i]); 69 v8::String::Utf8Value str(args[i]);
70 if (*str == NULL) return v8::Undefined(); 70 if (*str == NULL) return;
71 printf("%s", *str); 71 printf("%s", *str);
72 } 72 }
73 printf("\n"); 73 printf("\n");
74 return v8::Undefined();
75 } 74 }
76 75
77 76
78 static PrintExtension kPrintExtension; 77 static PrintExtension kPrintExtension;
79 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension); 78 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension);
80 79
81 80
82 static MaybeObject* GetGlobalProperty(const char* name) { 81 static MaybeObject* GetGlobalProperty(const char* name) {
83 Isolate* isolate = Isolate::Current(); 82 Isolate* isolate = Isolate::Current();
84 Handle<String> internalized_name = 83 Handle<String> internalized_name =
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 342 }
344 } 343 }
345 344
346 345
347 // Test that optimized code for different closures is actually shared 346 // Test that optimized code for different closures is actually shared
348 // immediately by the FastNewClosureStub when run in the same context. 347 // immediately by the FastNewClosureStub when run in the same context.
349 TEST(OptimizedCodeSharing) { 348 TEST(OptimizedCodeSharing) {
350 // Skip test if --cache-optimized-code is not activated by default because 349 // Skip test if --cache-optimized-code is not activated by default because
351 // FastNewClosureStub that is baked into the snapshot is incorrect. 350 // FastNewClosureStub that is baked into the snapshot is incorrect.
352 if (!FLAG_cache_optimized_code) return; 351 if (!FLAG_cache_optimized_code) return;
352 FLAG_stress_compaction = false;
353 FLAG_allow_natives_syntax = true; 353 FLAG_allow_natives_syntax = true;
354 CcTest::InitializeVM(); 354 CcTest::InitializeVM();
355 v8::HandleScope scope(CcTest::isolate()); 355 v8::HandleScope scope(CcTest::isolate());
356 for (int i = 0; i < 10; i++) { 356 for (int i = 0; i < 10; i++) {
357 LocalContext env; 357 LocalContext env;
358 env->Global()->Set(v8::String::New("x"), v8::Integer::New(i)); 358 env->Global()->Set(v8::String::New("x"), v8::Integer::New(i));
359 CompileRun("function MakeClosure() {" 359 CompileRun("function MakeClosure() {"
360 " return function() { return x; };" 360 " return function() { return x; };"
361 "}" 361 "}"
362 "var closure0 = MakeClosure();" 362 "var closure0 = MakeClosure();"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 CompileRun("function f() { a = 12345678 }; f();"); 421 CompileRun("function f() { a = 12345678 }; f();");
422 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); 422 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f"));
423 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 423 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
424 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); 424 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f"));
425 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 425 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
426 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); 426 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f"));
427 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 427 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
428 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f")); 428 CheckCodeForUnsafeLiteral(GetJSFunction(CcTest::env()->Global(), "f"));
429 } 429 }
430 #endif 430 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-ast.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698