OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 6988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6999 const char* call_17 = "Function.prototype.call.call(obj, this, 17)"; | 6999 const char* call_17 = "Function.prototype.call.call(obj, this, 17)"; |
7000 value = CompileRun(call_17); | 7000 value = CompileRun(call_17); |
7001 CHECK(!try_catch.HasCaught()); | 7001 CHECK(!try_catch.HasCaught()); |
7002 CHECK_EQ(17, value->Int32Value()); | 7002 CHECK_EQ(17, value->Int32Value()); |
7003 | 7003 |
7004 // Check that the call-as-function handler can be called through | 7004 // Check that the call-as-function handler can be called through |
7005 // new. | 7005 // new. |
7006 value = CompileRun("new obj(43)"); | 7006 value = CompileRun("new obj(43)"); |
7007 CHECK(!try_catch.HasCaught()); | 7007 CHECK(!try_catch.HasCaught()); |
7008 CHECK_EQ(-43, value->Int32Value()); | 7008 CHECK_EQ(-43, value->Int32Value()); |
7009 | |
7010 // Check that the call-as-function handler can be called through | |
Mads Ager (chromium)
2011/04/28 11:53:05
This needs more testing. Please add tests for call
| |
7011 // the API. | |
7012 v8::Handle<Value> args1[] = { v8_num(28) }; | |
7013 value = instance->Call(instance, 1, args1); | |
7014 CHECK(!try_catch.HasCaught()); | |
7015 CHECK_EQ(28, value->Int32Value()); | |
7009 } | 7016 } |
7010 | 7017 |
7011 | 7018 |
7012 static int CountHandles() { | 7019 static int CountHandles() { |
7013 return v8::HandleScope::NumberOfHandles(); | 7020 return v8::HandleScope::NumberOfHandles(); |
7014 } | 7021 } |
7015 | 7022 |
7016 | 7023 |
7017 static int Recurse(int depth, int iterations) { | 7024 static int Recurse(int depth, int iterations) { |
7018 v8::HandleScope scope; | 7025 v8::HandleScope scope; |
(...skipping 6872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
13891 CHECK(func2->CreationContext() == context2); | 13898 CHECK(func2->CreationContext() == context2); |
13892 CheckContextId(func2, 2); | 13899 CheckContextId(func2, 2); |
13893 CHECK(instance2->CreationContext() == context2); | 13900 CHECK(instance2->CreationContext() == context2); |
13894 CheckContextId(instance2, 2); | 13901 CheckContextId(instance2, 2); |
13895 } | 13902 } |
13896 | 13903 |
13897 context1.Dispose(); | 13904 context1.Dispose(); |
13898 context2.Dispose(); | 13905 context2.Dispose(); |
13899 context3.Dispose(); | 13906 context3.Dispose(); |
13900 } | 13907 } |
OLD | NEW |