OLD | NEW |
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 Loading... |
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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 CompileRun("function f() { a = 12345678 }; f();"); | 438 CompileRun("function f() { a = 12345678 }; f();"); |
439 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 439 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
440 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 440 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 441 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
442 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 442 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 443 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
444 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 444 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 445 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
446 } | 446 } |
447 #endif | 447 #endif |
OLD | NEW |