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 13730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13741 CHECK_LT(0, code.occupancy()); | 13741 CHECK_LT(0, code.occupancy()); |
13742 | 13742 |
13743 code_map = NULL; | 13743 code_map = NULL; |
13744 } | 13744 } |
13745 | 13745 |
13746 isolate->Exit(); | 13746 isolate->Exit(); |
13747 isolate->Dispose(); | 13747 isolate->Dispose(); |
13748 } | 13748 } |
13749 | 13749 |
13750 | 13750 |
13751 static int64_t cast(intptr_t x) { return static_cast<int64_t>(x); } | |
13752 | |
13753 | |
13754 THREADED_TEST(ExternalAllocatedMemory) { | 13751 THREADED_TEST(ExternalAllocatedMemory) { |
13755 v8::Isolate* isolate = CcTest::isolate(); | 13752 v8::Isolate* isolate = CcTest::isolate(); |
13756 v8::HandleScope outer(isolate); | 13753 v8::HandleScope outer(isolate); |
13757 v8::Local<Context> env(Context::New(isolate)); | 13754 v8::Local<Context> env(Context::New(isolate)); |
13758 CHECK(!env.IsEmpty()); | 13755 CHECK(!env.IsEmpty()); |
13759 const intptr_t kSize = 1024*1024; | 13756 const int64_t kSize = 1024*1024; |
13760 int64_t baseline = cast(isolate->AdjustAmountOfExternalAllocatedMemory(0)); | 13757 int64_t baseline = isolate->AdjustAmountOfExternalAllocatedMemory(0); |
13761 CHECK_EQ(baseline + cast(kSize), | 13758 CHECK_EQ(baseline + kSize, |
13762 cast(isolate->AdjustAmountOfExternalAllocatedMemory(kSize))); | 13759 isolate->AdjustAmountOfExternalAllocatedMemory(kSize)); |
13763 CHECK_EQ(baseline, | 13760 CHECK_EQ(baseline, |
13764 cast(isolate->AdjustAmountOfExternalAllocatedMemory(-kSize))); | 13761 isolate->AdjustAmountOfExternalAllocatedMemory(-kSize)); |
13765 } | 13762 } |
13766 | 13763 |
13767 | 13764 |
13768 // Regression test for issue 54, object templates with internal fields | 13765 // Regression test for issue 54, object templates with internal fields |
13769 // but no accessors or interceptors did not get their internal field | 13766 // but no accessors or interceptors did not get their internal field |
13770 // count set on instances. | 13767 // count set on instances. |
13771 THREADED_TEST(Regress54) { | 13768 THREADED_TEST(Regress54) { |
13772 LocalContext context; | 13769 LocalContext context; |
13773 v8::Isolate* isolate = context->GetIsolate(); | 13770 v8::Isolate* isolate = context->GetIsolate(); |
13774 v8::HandleScope outer(isolate); | 13771 v8::HandleScope outer(isolate); |
(...skipping 7049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20824 } | 20821 } |
20825 for (int i = 0; i < runs; i++) { | 20822 for (int i = 0; i < runs; i++) { |
20826 Local<String> expected; | 20823 Local<String> expected; |
20827 if (i != 0) { | 20824 if (i != 0) { |
20828 CHECK_EQ(v8_str("escape value"), values[i]); | 20825 CHECK_EQ(v8_str("escape value"), values[i]); |
20829 } else { | 20826 } else { |
20830 CHECK(values[i].IsEmpty()); | 20827 CHECK(values[i].IsEmpty()); |
20831 } | 20828 } |
20832 } | 20829 } |
20833 } | 20830 } |
OLD | NEW |