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

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

Issue 157503002: A64: Synchronize with r18444. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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-assembler-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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 static const char* kSource; 53 static const char* kSource;
54 }; 54 };
55 55
56 56
57 const char* PrintExtension::kSource = "native function print();"; 57 const char* PrintExtension::kSource = "native function print();";
58 58
59 59
60 v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate( 60 v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunctionTemplate(
61 v8::Isolate* isolate, 61 v8::Isolate* isolate,
62 v8::Handle<v8::String> str) { 62 v8::Handle<v8::String> str) {
63 return v8::FunctionTemplate::New(PrintExtension::Print); 63 return v8::FunctionTemplate::New(isolate, PrintExtension::Print);
64 } 64 }
65 65
66 66
67 void PrintExtension::Print(const v8::FunctionCallbackInfo<v8::Value>& args) { 67 void PrintExtension::Print(const v8::FunctionCallbackInfo<v8::Value>& 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(args.GetIsolate()); 70 v8::HandleScope scope(args.GetIsolate());
71 v8::String::Utf8Value str(args[i]); 71 v8::String::Utf8Value str(args[i]);
72 if (*str == NULL) return; 72 if (*str == NULL) return;
73 printf("%s", *str); 73 printf("%s", *str);
(...skipping 23 matching lines...) Expand all
97 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, 97 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE,
98 kNonStrictMode); 98 kNonStrictMode);
99 } 99 }
100 100
101 101
102 static Handle<JSFunction> Compile(const char* source) { 102 static Handle<JSFunction> Compile(const char* source) {
103 Isolate* isolate = CcTest::i_isolate(); 103 Isolate* isolate = CcTest::i_isolate();
104 Handle<String> source_code( 104 Handle<String> source_code(
105 isolate->factory()->NewStringFromUtf8(CStrVector(source))); 105 isolate->factory()->NewStringFromUtf8(CStrVector(source)));
106 Handle<SharedFunctionInfo> shared_function = 106 Handle<SharedFunctionInfo> shared_function =
107 Compiler::Compile(source_code, 107 Compiler::CompileScript(source_code,
108 Handle<String>(), 108 Handle<String>(),
109 0, 109 0,
110 0, 110 0,
111 false, 111 false,
112 Handle<Context>(isolate->native_context()), 112 Handle<Context>(isolate->native_context()),
113 NULL, 113 NULL, NULL,
114 NULL, 114 Handle<String>::null(),
115 Handle<String>::null(), 115 NOT_NATIVES_CODE);
116 NOT_NATIVES_CODE);
117 return isolate->factory()->NewFunctionFromSharedFunctionInfo( 116 return isolate->factory()->NewFunctionFromSharedFunctionInfo(
118 shared_function, isolate->native_context()); 117 shared_function, isolate->native_context());
119 } 118 }
120 119
121 120
122 static double Inc(Isolate* isolate, int x) { 121 static double Inc(Isolate* isolate, int x) {
123 const char* source = "result = %d + 1;"; 122 const char* source = "result = %d + 1;";
124 EmbeddedVector<char, 512> buffer; 123 EmbeddedVector<char, 512> buffer;
125 OS::SNPrintF(buffer, source, x); 124 OS::SNPrintF(buffer, source, x);
126 125
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 CompileRun("function f() { a = 12345678 }; f();"); 437 CompileRun("function f() { a = 12345678 }; f();");
439 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 438 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
440 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 439 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 440 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
442 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 441 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 442 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
444 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 443 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 444 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
446 } 445 }
447 #endif 446 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-assembler-x64.cc ('k') | test/cctest/test-cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698