OLD | NEW |
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 6198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6209 env->Enter(); | 6209 env->Enter(); |
6210 v8::Handle<Value> value = NestedScope(env); | 6210 v8::Handle<Value> value = NestedScope(env); |
6211 v8::Handle<String> str = value->ToString(); | 6211 v8::Handle<String> str = value->ToString(); |
6212 env->Exit(); | 6212 env->Exit(); |
6213 env.Dispose(); | 6213 env.Dispose(); |
6214 } | 6214 } |
6215 | 6215 |
6216 | 6216 |
6217 THREADED_TEST(ExternalAllocatedMemory) { | 6217 THREADED_TEST(ExternalAllocatedMemory) { |
6218 v8::HandleScope outer; | 6218 v8::HandleScope outer; |
| 6219 v8::Persistent<Context> env = Context::New(); |
6219 const int kSize = 1024*1024; | 6220 const int kSize = 1024*1024; |
6220 CHECK_EQ(v8::V8::AdjustAmountOfExternalAllocatedMemory(kSize), kSize); | 6221 CHECK_EQ(v8::V8::AdjustAmountOfExternalAllocatedMemory(kSize), kSize); |
6221 CHECK_EQ(v8::V8::AdjustAmountOfExternalAllocatedMemory(-kSize), 0); | 6222 CHECK_EQ(v8::V8::AdjustAmountOfExternalAllocatedMemory(-kSize), 0); |
6222 } | 6223 } |
6223 | 6224 |
6224 | 6225 |
6225 THREADED_TEST(DisposeEnteredContext) { | 6226 THREADED_TEST(DisposeEnteredContext) { |
6226 v8::HandleScope scope; | 6227 v8::HandleScope scope; |
6227 LocalContext outer; | 6228 LocalContext outer; |
6228 { v8::Persistent<v8::Context> inner = v8::Context::New(); | 6229 { v8::Persistent<v8::Context> inner = v8::Context::New(); |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7540 "var obj = { x: { foo: 42 }, y: 87 };\n" | 7541 "var obj = { x: { foo: 42 }, y: 87 };\n" |
7541 "var x = obj.x;\n" | 7542 "var x = obj.x;\n" |
7542 "delete obj.y;\n" | 7543 "delete obj.y;\n" |
7543 "for (var i = 0; i < 5; i++) f(obj);"); | 7544 "for (var i = 0; i < 5; i++) f(obj);"); |
7544 // Detach the global object to make 'this' refer directly to the | 7545 // Detach the global object to make 'this' refer directly to the |
7545 // global object (not the proxy), and make sure that the dictionary | 7546 // global object (not the proxy), and make sure that the dictionary |
7546 // load IC doesn't mess up loading directly from the global object. | 7547 // load IC doesn't mess up loading directly from the global object. |
7547 context->DetachGlobal(); | 7548 context->DetachGlobal(); |
7548 CHECK_EQ(42, CompileRun("f(this).foo")->Int32Value()); | 7549 CHECK_EQ(42, CompileRun("f(this).foo")->Int32Value()); |
7549 } | 7550 } |
OLD | NEW |