OLD | NEW |
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 10847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10858 v8::Persistent<Context> env = Context::New(); | 10858 v8::Persistent<Context> env = Context::New(); |
10859 env->Enter(); | 10859 env->Enter(); |
10860 v8::Handle<Value> value = NestedScope(env); | 10860 v8::Handle<Value> value = NestedScope(env); |
10861 v8::Handle<String> str(value->ToString()); | 10861 v8::Handle<String> str(value->ToString()); |
10862 CHECK(!str.IsEmpty()); | 10862 CHECK(!str.IsEmpty()); |
10863 env->Exit(); | 10863 env->Exit(); |
10864 env.Dispose(); | 10864 env.Dispose(); |
10865 } | 10865 } |
10866 | 10866 |
10867 | 10867 |
| 10868 static int64_t cast(intptr_t x) { return static_cast<int64_t>(x); } |
| 10869 |
| 10870 |
10868 THREADED_TEST(ExternalAllocatedMemory) { | 10871 THREADED_TEST(ExternalAllocatedMemory) { |
10869 v8::HandleScope outer; | 10872 v8::HandleScope outer; |
10870 v8::Persistent<Context> env(Context::New()); | 10873 v8::Persistent<Context> env(Context::New()); |
10871 CHECK(!env.IsEmpty()); | 10874 CHECK(!env.IsEmpty()); |
10872 const intptr_t kSize = 1024*1024; | 10875 const intptr_t kSize = 1024*1024; |
10873 CHECK_EQ(v8::V8::AdjustAmountOfExternalAllocatedMemory(kSize), kSize); | 10876 CHECK_EQ(cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(kSize)), |
10874 CHECK_EQ(v8::V8::AdjustAmountOfExternalAllocatedMemory(-kSize), | 10877 cast(kSize)); |
10875 static_cast<intptr_t>(0)); | 10878 CHECK_EQ(cast(v8::V8::AdjustAmountOfExternalAllocatedMemory(-kSize)), |
| 10879 cast(0)); |
10876 } | 10880 } |
10877 | 10881 |
10878 | 10882 |
10879 THREADED_TEST(DisposeEnteredContext) { | 10883 THREADED_TEST(DisposeEnteredContext) { |
10880 v8::HandleScope scope; | 10884 v8::HandleScope scope; |
10881 LocalContext outer; | 10885 LocalContext outer; |
10882 { v8::Persistent<v8::Context> inner = v8::Context::New(); | 10886 { v8::Persistent<v8::Context> inner = v8::Context::New(); |
10883 inner->Enter(); | 10887 inner->Enter(); |
10884 inner.Dispose(); | 10888 inner.Dispose(); |
10885 inner.Clear(); | 10889 inner.Clear(); |
(...skipping 5509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16395 | 16399 |
16396 TEST(SecondaryStubCache) { | 16400 TEST(SecondaryStubCache) { |
16397 StubCacheHelper(true); | 16401 StubCacheHelper(true); |
16398 } | 16402 } |
16399 | 16403 |
16400 | 16404 |
16401 TEST(PrimaryStubCache) { | 16405 TEST(PrimaryStubCache) { |
16402 StubCacheHelper(false); | 16406 StubCacheHelper(false); |
16403 } | 16407 } |
16404 | 16408 |
OLD | NEW |