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 14835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14846 v8::Isolate* isolate = CcTest::isolate(); | 14846 v8::Isolate* isolate = CcTest::isolate(); |
14847 v8::HandleScope outer(isolate); | 14847 v8::HandleScope outer(isolate); |
14848 v8::Local<Context> env(Context::New(isolate)); | 14848 v8::Local<Context> env(Context::New(isolate)); |
14849 CHECK(!env.IsEmpty()); | 14849 CHECK(!env.IsEmpty()); |
14850 const int64_t kSize = 1024*1024; | 14850 const int64_t kSize = 1024*1024; |
14851 int64_t baseline = isolate->AdjustAmountOfExternalAllocatedMemory(0); | 14851 int64_t baseline = isolate->AdjustAmountOfExternalAllocatedMemory(0); |
14852 CHECK_EQ(baseline + kSize, | 14852 CHECK_EQ(baseline + kSize, |
14853 isolate->AdjustAmountOfExternalAllocatedMemory(kSize)); | 14853 isolate->AdjustAmountOfExternalAllocatedMemory(kSize)); |
14854 CHECK_EQ(baseline, | 14854 CHECK_EQ(baseline, |
14855 isolate->AdjustAmountOfExternalAllocatedMemory(-kSize)); | 14855 isolate->AdjustAmountOfExternalAllocatedMemory(-kSize)); |
14856 const int64_t kTriggerGCSize = | 14856 const int64_t kTriggerGCSize = i::kExternalAllocationLimit + 1; |
14857 v8::internal::Internals::kExternalAllocationLimit + 1; | |
14858 CHECK_EQ(baseline + kTriggerGCSize, | 14857 CHECK_EQ(baseline + kTriggerGCSize, |
14859 isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize)); | 14858 isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize)); |
14860 CHECK_EQ(baseline, | 14859 CHECK_EQ(baseline, |
14861 isolate->AdjustAmountOfExternalAllocatedMemory(-kTriggerGCSize)); | 14860 isolate->AdjustAmountOfExternalAllocatedMemory(-kTriggerGCSize)); |
14862 } | 14861 } |
14863 | 14862 |
14864 | 14863 |
14865 TEST(Regress51719) { | 14864 TEST(Regress51719) { |
14866 i::FLAG_incremental_marking = false; | 14865 i::FLAG_incremental_marking = false; |
14867 CcTest::InitializeVM(); | 14866 CcTest::InitializeVM(); |
14868 | 14867 |
14869 const int64_t kTriggerGCSize = | 14868 const int64_t kTriggerGCSize = i::kExternalAllocationLimit + 1; |
14870 v8::internal::Internals::kExternalAllocationLimit + 1; | |
14871 v8::Isolate* isolate = CcTest::isolate(); | 14869 v8::Isolate* isolate = CcTest::isolate(); |
14872 isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize); | 14870 isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize); |
14873 } | 14871 } |
14874 | 14872 |
14875 | 14873 |
14876 // Regression test for issue 54, object templates with internal fields | 14874 // Regression test for issue 54, object templates with internal fields |
14877 // but no accessors or interceptors did not get their internal field | 14875 // but no accessors or interceptors did not get their internal field |
14878 // count set on instances. | 14876 // count set on instances. |
14879 THREADED_TEST(Regress54) { | 14877 THREADED_TEST(Regress54) { |
14880 LocalContext context; | 14878 LocalContext context; |
(...skipping 10459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25340 } | 25338 } |
25341 | 25339 |
25342 TEST(PrivateForApiIsNumber) { | 25340 TEST(PrivateForApiIsNumber) { |
25343 LocalContext context; | 25341 LocalContext context; |
25344 v8::Isolate* isolate = CcTest::isolate(); | 25342 v8::Isolate* isolate = CcTest::isolate(); |
25345 v8::HandleScope scope(isolate); | 25343 v8::HandleScope scope(isolate); |
25346 | 25344 |
25347 // Shouldn't crash. | 25345 // Shouldn't crash. |
25348 v8::Private::ForApi(isolate, v8_str("42")); | 25346 v8::Private::ForApi(isolate, v8_str("42")); |
25349 } | 25347 } |
OLD | NEW |