| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 | 95 |
| 96 static MaybeObject* GetGlobalProperty(const char* name) { | 96 static MaybeObject* GetGlobalProperty(const char* name) { |
| 97 Handle<String> symbol = FACTORY->LookupAsciiSymbol(name); | 97 Handle<String> symbol = FACTORY->LookupAsciiSymbol(name); |
| 98 return Isolate::Current()->context()->global_object()->GetProperty(*symbol); | 98 return Isolate::Current()->context()->global_object()->GetProperty(*symbol); |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 static void SetGlobalProperty(const char* name, Object* value) { | 102 static void SetGlobalProperty(const char* name, Object* value) { |
| 103 Isolate* isolate = Isolate::Current(); |
| 103 Handle<Object> object(value); | 104 Handle<Object> object(value); |
| 104 Handle<String> symbol = FACTORY->LookupAsciiSymbol(name); | 105 Handle<String> symbol = FACTORY->LookupAsciiSymbol(name); |
| 105 Handle<JSObject> global(Isolate::Current()->context()->global_object()); | 106 Handle<JSObject> global(Isolate::Current()->context()->global_object()); |
| 106 SetProperty(global, symbol, object, NONE, kNonStrictMode); | 107 SetProperty(isolate, global, symbol, object, NONE, kNonStrictMode); |
| 107 } | 108 } |
| 108 | 109 |
| 109 | 110 |
| 110 static Handle<JSFunction> Compile(const char* source) { | 111 static Handle<JSFunction> Compile(const char* source) { |
| 111 Handle<String> source_code(FACTORY->NewStringFromUtf8(CStrVector(source))); | 112 Handle<String> source_code(FACTORY->NewStringFromUtf8(CStrVector(source))); |
| 112 Handle<SharedFunctionInfo> shared_function = | 113 Handle<SharedFunctionInfo> shared_function = |
| 113 Compiler::Compile(source_code, | 114 Compiler::Compile(source_code, |
| 114 Handle<String>(), | 115 Handle<String>(), |
| 115 0, | 116 0, |
| 116 0, | 117 0, |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 CompileRun("function f() { a = 12345678 }; f();"); | 425 CompileRun("function f() { a = 12345678 }; f();"); |
| 425 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 426 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
| 426 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 427 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
| 427 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 428 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
| 428 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 429 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
| 429 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 430 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
| 430 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 431 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
| 431 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); | 432 CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f")); |
| 432 } | 433 } |
| 433 #endif | 434 #endif |
| OLD | NEW |