Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: test/cctest/test-compiler.cc

Issue 233233004: Handlify GetProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 CHECK(!fun0.is_null()); 229 CHECK(!fun0.is_null());
230 Isolate* isolate = fun0->GetIsolate(); 230 Isolate* isolate = fun0->GetIsolate();
231 231
232 // Run the generated code to populate the global object with 'foo'. 232 // Run the generated code to populate the global object with 'foo'.
233 Handle<JSObject> global(isolate->context()->global_object()); 233 Handle<JSObject> global(isolate->context()->global_object());
234 Execution::Call(isolate, fun0, global, 0, NULL).Check(); 234 Execution::Call(isolate, fun0, global, 0, NULL).Check();
235 235
236 Handle<String> foo_string = isolate->factory()->InternalizeOneByteString( 236 Handle<String> foo_string = isolate->factory()->InternalizeOneByteString(
237 STATIC_ASCII_VECTOR("foo")); 237 STATIC_ASCII_VECTOR("foo"));
238 Handle<Object> fun1 = Object::GetProperty( 238 Handle<Object> fun1 = Object::GetProperty(
239 isolate->global_object(), foo_string); 239 isolate->global_object(), foo_string).ToHandleChecked();
240 CHECK(fun1->IsJSFunction()); 240 CHECK(fun1->IsJSFunction());
241 241
242 Handle<Object> argv[] = { isolate->factory()->InternalizeOneByteString( 242 Handle<Object> argv[] = { isolate->factory()->InternalizeOneByteString(
243 STATIC_ASCII_VECTOR("hello")) }; 243 STATIC_ASCII_VECTOR("hello")) };
244 Execution::Call(isolate, 244 Execution::Call(isolate,
245 Handle<JSFunction>::cast(fun1), 245 Handle<JSFunction>::cast(fun1),
246 global, 246 global,
247 ARRAY_SIZE(argv), 247 ARRAY_SIZE(argv),
248 argv).Check(); 248 argv).Check();
249 } 249 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 CompileRun("function f() { a = 12345678 }; f();"); 373 CompileRun("function f() { a = 12345678 }; f();");
374 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 374 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
375 CompileRun("function f(x) { a = 12345678 + x}; f(1);"); 375 CompileRun("function f(x) { a = 12345678 + x}; f(1);");
376 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 376 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
377 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);"); 377 CompileRun("function f(x) { var arguments = 1; x += 12345678}; f(1);");
378 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 378 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
379 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);"); 379 CompileRun("function f(x) { var arguments = 1; x = 12345678}; f(1);");
380 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f")); 380 CheckCodeForUnsafeLiteral(GetJSFunction(context->Global(), "f"));
381 } 381 }
382 #endif 382 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-api.cc ('k') | test/cctest/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698