| 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 22 matching lines...) Expand all Loading... |
| 33 #include "compiler.h" | 33 #include "compiler.h" |
| 34 #include "disasm.h" | 34 #include "disasm.h" |
| 35 #include "cctest.h" | 35 #include "cctest.h" |
| 36 | 36 |
| 37 using namespace v8::internal; | 37 using namespace v8::internal; |
| 38 | 38 |
| 39 static Handle<Object> GetGlobalProperty(const char* name) { | 39 static Handle<Object> GetGlobalProperty(const char* name) { |
| 40 Isolate* isolate = CcTest::i_isolate(); | 40 Isolate* isolate = CcTest::i_isolate(); |
| 41 Handle<String> internalized_name = | 41 Handle<String> internalized_name = |
| 42 isolate->factory()->InternalizeUtf8String(name); | 42 isolate->factory()->InternalizeUtf8String(name); |
| 43 return GlobalObject::GetPropertyNoExceptionThrown( | 43 return Object::GetProperty( |
| 44 isolate->global_object(), internalized_name); | 44 isolate->global_object(), internalized_name).ToHandleChecked(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 | 47 |
| 48 static void SetGlobalProperty(const char* name, Object* value) { | 48 static void SetGlobalProperty(const char* name, Object* value) { |
| 49 Isolate* isolate = CcTest::i_isolate(); | 49 Isolate* isolate = CcTest::i_isolate(); |
| 50 Handle<Object> object(value, isolate); | 50 Handle<Object> object(value, isolate); |
| 51 Handle<String> internalized_name = | 51 Handle<String> internalized_name = |
| 52 isolate->factory()->InternalizeUtf8String(name); | 52 isolate->factory()->InternalizeUtf8String(name); |
| 53 Handle<JSObject> global(isolate->context()->global_object()); | 53 Handle<JSObject> global(isolate->context()->global_object()); |
| 54 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, | 54 Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE, |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // Run the generated code to populate the global object with 'foo'. | 247 // Run the generated code to populate the global object with 'foo'. |
| 248 bool has_pending_exception; | 248 bool has_pending_exception; |
| 249 Handle<JSObject> global(isolate->context()->global_object()); | 249 Handle<JSObject> global(isolate->context()->global_object()); |
| 250 Execution::Call( | 250 Execution::Call( |
| 251 isolate, fun0, global, 0, NULL, &has_pending_exception); | 251 isolate, fun0, global, 0, NULL, &has_pending_exception); |
| 252 CHECK(!has_pending_exception); | 252 CHECK(!has_pending_exception); |
| 253 | 253 |
| 254 Handle<String> foo_string = isolate->factory()->InternalizeOneByteString( | 254 Handle<String> foo_string = isolate->factory()->InternalizeOneByteString( |
| 255 STATIC_ASCII_VECTOR("foo")); | 255 STATIC_ASCII_VECTOR("foo")); |
| 256 Handle<Object> fun1 = Object::GetProperty( | 256 Handle<Object> fun1 = Object::GetProperty( |
| 257 isolate->global_object(), foo_string); | 257 isolate->global_object(), foo_string).ToHandleChecked(); |
| 258 CHECK(fun1->IsJSFunction()); | 258 CHECK(fun1->IsJSFunction()); |
| 259 | 259 |
| 260 Handle<Object> argv[] = { isolate->factory()->InternalizeOneByteString( | 260 Handle<Object> argv[] = { isolate->factory()->InternalizeOneByteString( |
| 261 STATIC_ASCII_VECTOR("hello")) }; | 261 STATIC_ASCII_VECTOR("hello")) }; |
| 262 Execution::Call(isolate, | 262 Execution::Call(isolate, |
| 263 Handle<JSFunction>::cast(fun1), | 263 Handle<JSFunction>::cast(fun1), |
| 264 global, | 264 global, |
| 265 ARRAY_SIZE(argv), | 265 ARRAY_SIZE(argv), |
| 266 argv, | 266 argv, |
| 267 &has_pending_exception); | 267 &has_pending_exception); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 CompileRun("function f() { a = 12345678 }; f();"); | 393 CompileRun("function f() { a = 12345678 }; f();"); |
| 394 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 394 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 395 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); | 395 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); |
| 396 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 396 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 397 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); | 397 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); |
| 398 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 398 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 399 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); | 399 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); |
| 400 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); | 400 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); |
| 401 } | 401 } |
| 402 #endif | 402 #endif |
| OLD | NEW |