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

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

Issue 108008: Merge change that allows the API call-as-function handlers on... (Closed) Base URL: http://v8.googlecode.com/svn/branches/1.1/
Patch Set: '' Created 11 years, 7 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/builtins-ia32.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. 1 // Copyright 2007-2008 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 4590 matching lines...) Expand 10 before | Expand all | Expand 10 after
4601 // must work for non-function receivers. 4601 // must work for non-function receivers.
4602 const char* apply_99 = "Function.prototype.call.apply(obj, [this, 99])"; 4602 const char* apply_99 = "Function.prototype.call.apply(obj, [this, 99])";
4603 value = Script::Compile(v8_str(apply_99))->Run(); 4603 value = Script::Compile(v8_str(apply_99))->Run();
4604 CHECK(!try_catch.HasCaught()); 4604 CHECK(!try_catch.HasCaught());
4605 CHECK_EQ(99, value->Int32Value()); 4605 CHECK_EQ(99, value->Int32Value());
4606 4606
4607 const char* call_17 = "Function.prototype.call.call(obj, this, 17)"; 4607 const char* call_17 = "Function.prototype.call.call(obj, this, 17)";
4608 value = Script::Compile(v8_str(call_17))->Run(); 4608 value = Script::Compile(v8_str(call_17))->Run();
4609 CHECK(!try_catch.HasCaught()); 4609 CHECK(!try_catch.HasCaught());
4610 CHECK_EQ(17, value->Int32Value()); 4610 CHECK_EQ(17, value->Int32Value());
4611
4612 // Try something that will cause an exception: Call the object as a
4613 // constructor. This should be the last test.
4614 value = Script::Compile(v8_str("new obj(42)"))->Run();
4615 CHECK(try_catch.HasCaught());
4616 } 4611 }
4617 4612
4618 4613
4619 static int CountHandles() { 4614 static int CountHandles() {
4620 return v8::HandleScope::NumberOfHandles(); 4615 return v8::HandleScope::NumberOfHandles();
4621 } 4616 }
4622 4617
4623 4618
4624 static int Recurse(int depth, int iterations) { 4619 static int Recurse(int depth, int iterations) {
4625 v8::HandleScope scope; 4620 v8::HandleScope scope;
(...skipping 1554 matching lines...) Expand 10 before | Expand all | Expand 10 after
6180 // Check without 'eval' or 'with'. 6175 // Check without 'eval' or 'with'.
6181 v8::Handle<v8::Value> res = 6176 v8::Handle<v8::Value> res =
6182 CompileRun("function f() { x = 42; return x; }; f()"); 6177 CompileRun("function f() { x = 42; return x; }; f()");
6183 // Check with 'eval'. 6178 // Check with 'eval'.
6184 res = CompileRun("function f() { eval('1'); y = 42; return y; }; f()"); 6179 res = CompileRun("function f() { eval('1'); y = 42; return y; }; f()");
6185 CHECK_EQ(v8::Integer::New(42), res); 6180 CHECK_EQ(v8::Integer::New(42), res);
6186 // Check with 'with'. 6181 // Check with 'with'.
6187 res = CompileRun("function f() { with (this) { y = 42 }; return y; }; f()"); 6182 res = CompileRun("function f() { with (this) { y = 42 }; return y; }; f()");
6188 CHECK_EQ(v8::Integer::New(42), res); 6183 CHECK_EQ(v8::Integer::New(42), res);
6189 } 6184 }
OLDNEW
« no previous file with comments | « src/builtins-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698