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

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

Issue 10928182: Fix printf formatting in test-compiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 | « no previous file | 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunction( 61 v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunction(
62 v8::Handle<v8::String> str) { 62 v8::Handle<v8::String> str) {
63 return v8::FunctionTemplate::New(PrintExtension::Print); 63 return v8::FunctionTemplate::New(PrintExtension::Print);
64 } 64 }
65 65
66 66
67 v8::Handle<v8::Value> PrintExtension::Print(const v8::Arguments& args) { 67 v8::Handle<v8::Value> PrintExtension::Print(const v8::Arguments& args) {
68 for (int i = 0; i < args.Length(); i++) { 68 for (int i = 0; i < args.Length(); i++) {
69 if (i != 0) printf(" "); 69 if (i != 0) printf(" ");
70 v8::HandleScope scope; 70 v8::HandleScope scope;
71 v8::Handle<v8::Value> arg = args[i]; 71 v8::String::Utf8Value str(args[i]);
72 v8::Handle<v8::String> string_obj = arg->ToString(); 72 if (*str == NULL) return v8::Undefined();
73 if (string_obj.IsEmpty()) return string_obj; 73 printf("%s", *str);
74 int length = string_obj->Length();
75 uint16_t* string = NewArray<uint16_t>(length + 1);
76 string_obj->Write(string);
77 for (int j = 0; j < length; j++)
78 printf("%lc", static_cast<wchar_t>(string[j]));
79 DeleteArray(string);
80 } 74 }
81 printf("\n"); 75 printf("\n");
82 return v8::Undefined(); 76 return v8::Undefined();
83 } 77 }
84 78
85 79
86 static PrintExtension kPrintExtension; 80 static PrintExtension kPrintExtension;
87 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension); 81 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension);
88 82
89 83
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 CompileRun("function f() { a = 12345678 }; f();"); 424 CompileRun("function f() { a = 12345678 }; f();");
431 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); 425 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));
432 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 426 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
433 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); 427 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));
434 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 428 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
435 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); 429 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));
436 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 430 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
437 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); 431 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));
438 } 432 }
439 #endif 433 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698