OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include <stdlib.h> | 28 #include <stdlib.h> |
29 #include <wchar.h> // wint_t | 29 #include <wchar.h> |
30 | 30 |
31 #include "v8.h" | 31 #include "v8.h" |
32 | 32 |
33 #include "compiler.h" | 33 #include "compiler.h" |
34 #include "disasm.h" | 34 #include "disasm.h" |
35 #include "disassembler.h" | 35 #include "disassembler.h" |
36 #include "execution.h" | 36 #include "execution.h" |
37 #include "factory.h" | 37 #include "factory.h" |
38 #include "platform.h" | 38 #include "platform.h" |
39 #include "cctest.h" | 39 #include "cctest.h" |
(...skipping 28 matching lines...) Expand all Loading... |
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::Handle<v8::Value> arg = args[i]; |
72 v8::Handle<v8::String> string_obj = arg->ToString(); | 72 v8::Handle<v8::String> string_obj = arg->ToString(); |
73 if (string_obj.IsEmpty()) return string_obj; | 73 if (string_obj.IsEmpty()) return string_obj; |
74 int length = string_obj->Length(); | 74 int length = string_obj->Length(); |
75 uint16_t* string = NewArray<uint16_t>(length + 1); | 75 uint16_t* string = NewArray<uint16_t>(length + 1); |
76 string_obj->Write(string); | 76 string_obj->Write(string); |
77 for (int j = 0; j < length; j++) | 77 for (int j = 0; j < length; j++) |
78 printf("%lc", static_cast<wint_t>(string[j])); | 78 printf("%lc", static_cast<wchar_t>(string[j])); |
79 DeleteArray(string); | 79 DeleteArray(string); |
80 } | 80 } |
81 printf("\n"); | 81 printf("\n"); |
82 return v8::Undefined(); | 82 return v8::Undefined(); |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 static PrintExtension kPrintExtension; | 86 static PrintExtension kPrintExtension; |
87 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension); | 87 v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension); |
88 | 88 |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 CompileRun("function f() { a = 12345678 }; f();"); | 396 CompileRun("function f() { a = 12345678 }; f();"); |
397 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 397 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
398 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 398 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
399 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 399 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
400 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 400 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
401 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 401 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
402 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 402 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
403 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 403 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
404 } | 404 } |
405 #endif | 405 #endif |
OLD | NEW |