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

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

Issue 223653003: Return MaybeHandle from NewExternalStringFrom*. (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 | « src/handles.h ('k') | test/cctest/test-parsing.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 15104 matching lines...) Expand 10 before | Expand all | Expand 10 after
15115 LocalContext env; 15115 LocalContext env;
15116 i::Factory* factory = CcTest::i_isolate()->factory(); 15116 i::Factory* factory = CcTest::i_isolate()->factory();
15117 v8::HandleScope scope(env->GetIsolate()); 15117 v8::HandleScope scope(env->GetIsolate());
15118 AsciiVectorResource ascii_resource( 15118 AsciiVectorResource ascii_resource(
15119 i::Vector<const char>(c_string, i::StrLength(c_string))); 15119 i::Vector<const char>(c_string, i::StrLength(c_string)));
15120 UC16VectorResource uc16_resource( 15120 UC16VectorResource uc16_resource(
15121 i::Vector<const uint16_t>(two_byte_string, 15121 i::Vector<const uint16_t>(two_byte_string,
15122 i::StrLength(c_string))); 15122 i::StrLength(c_string)));
15123 15123
15124 Local<String> lhs(v8::Utils::ToLocal( 15124 Local<String> lhs(v8::Utils::ToLocal(
15125 factory->NewExternalStringFromAscii(&ascii_resource))); 15125 factory->NewExternalStringFromAscii(&ascii_resource)
15126 .ToHandleChecked()));
15126 Local<String> rhs(v8::Utils::ToLocal( 15127 Local<String> rhs(v8::Utils::ToLocal(
15127 factory->NewExternalStringFromAscii(&ascii_resource))); 15128 factory->NewExternalStringFromAscii(&ascii_resource)
15129 .ToHandleChecked()));
15128 15130
15129 env->Global()->Set(v8_str("lhs"), lhs); 15131 env->Global()->Set(v8_str("lhs"), lhs);
15130 env->Global()->Set(v8_str("rhs"), rhs); 15132 env->Global()->Set(v8_str("rhs"), rhs);
15131 15133
15132 CompileRun( 15134 CompileRun(
15133 "var cons = lhs + rhs;" 15135 "var cons = lhs + rhs;"
15134 "var slice = lhs.substring(1, lhs.length - 1);" 15136 "var slice = lhs.substring(1, lhs.length - 1);"
15135 "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);"); 15137 "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);");
15136 15138
15137 CHECK(lhs->IsOneByte()); 15139 CHECK(lhs->IsOneByte());
(...skipping 7277 matching lines...) Expand 10 before | Expand all | Expand 10 after
22415 "f.call(friend);"); 22417 "f.call(friend);");
22416 CHECK_EQ(2, named_access_count); 22418 CHECK_EQ(2, named_access_count);
22417 22419
22418 // Test access using Object.setPrototypeOf reflective method. 22420 // Test access using Object.setPrototypeOf reflective method.
22419 named_access_count = 0; 22421 named_access_count = 0;
22420 CompileRun("Object.setPrototypeOf(friend, {});"); 22422 CompileRun("Object.setPrototypeOf(friend, {});");
22421 CHECK_EQ(1, named_access_count); 22423 CHECK_EQ(1, named_access_count);
22422 CompileRun("Object.getPrototypeOf(friend);"); 22424 CompileRun("Object.getPrototypeOf(friend);");
22423 CHECK_EQ(2, named_access_count); 22425 CHECK_EQ(2, named_access_count);
22424 } 22426 }
OLDNEW
« no previous file with comments | « src/handles.h ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698