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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 static void SetGlobalProperty(const char* name, Object* value) { | 47 static void SetGlobalProperty(const char* name, Object* value) { |
48 Isolate* isolate = CcTest::i_isolate(); | 48 Isolate* isolate = CcTest::i_isolate(); |
49 Handle<Object> object(value, isolate); | 49 Handle<Object> object(value, isolate); |
50 Handle<String> internalized_name = | 50 Handle<String> internalized_name = |
51 isolate->factory()->InternalizeUtf8String(name); | 51 isolate->factory()->InternalizeUtf8String(name); |
52 Handle<JSObject> global(isolate->context()->global_object()); | 52 Handle<JSObject> global(isolate->context()->global_object()); |
53 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, | 53 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, |
54 kSloppyMode); | 54 SLOPPY); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 static Handle<JSFunction> Compile(const char* source) { | 58 static Handle<JSFunction> Compile(const char* source) { |
59 Isolate* isolate = CcTest::i_isolate(); | 59 Isolate* isolate = CcTest::i_isolate(); |
60 Handle<String> source_code( | 60 Handle<String> source_code( |
61 isolate->factory()->NewStringFromUtf8(CStrVector(source))); | 61 isolate->factory()->NewStringFromUtf8(CStrVector(source))); |
62 Handle<SharedFunctionInfo> shared_function = | 62 Handle<SharedFunctionInfo> shared_function = |
63 Compiler::CompileScript(source_code, | 63 Compiler::CompileScript(source_code, |
64 Handle<String>(), | 64 Handle<String>(), |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 CompileRun("function f() { a = 12345678 }; f();"); | 394 CompileRun("function f() { a = 12345678 }; f();"); |
395 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 395 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
396 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 396 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
397 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 397 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
398 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 398 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
399 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 399 CheckCodeForUnsafeLiteral(GetJSFunction(context->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(context->Global(), "f")); | 401 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
402 } | 402 } |
403 #endif | 403 #endif |
OLD | NEW |