Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Side by Side Diff: test/cctest/test-heap.cc

Issue 1303403004: [Interpreter] Add support for parameter variables. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_add_bytecodes
Patch Set: Address review comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 heap->CollectGarbage(OLD_SPACE); 704 heap->CollectGarbage(OLD_SPACE);
705 705
706 CHECK(WeakPointerCleared); 706 CHECK(WeakPointerCleared);
707 } 707 }
708 708
709 709
710 TEST(BytecodeArray) { 710 TEST(BytecodeArray) {
711 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; 711 static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a};
712 static const int kRawBytesSize = sizeof(kRawBytes); 712 static const int kRawBytesSize = sizeof(kRawBytes);
713 static const int kFrameSize = 32; 713 static const int kFrameSize = 32;
714 static const int kParameterCount = 2;
714 715
715 CcTest::InitializeVM(); 716 CcTest::InitializeVM();
716 Isolate* isolate = CcTest::i_isolate(); 717 Isolate* isolate = CcTest::i_isolate();
717 Heap* heap = isolate->heap(); 718 Heap* heap = isolate->heap();
718 Factory* factory = isolate->factory(); 719 Factory* factory = isolate->factory();
719 HandleScope scope(isolate); 720 HandleScope scope(isolate);
720 721
721 // Allocate and initialize BytecodeArray 722 // Allocate and initialize BytecodeArray
722 Handle<BytecodeArray> array = 723 Handle<BytecodeArray> array = factory->NewBytecodeArray(
723 factory->NewBytecodeArray(kRawBytesSize, kRawBytes, kFrameSize); 724 kRawBytesSize, kRawBytes, kFrameSize, kParameterCount);
724 725
725 CHECK(array->IsBytecodeArray()); 726 CHECK(array->IsBytecodeArray());
726 CHECK_EQ(array->length(), (int)sizeof(kRawBytes)); 727 CHECK_EQ(array->length(), (int)sizeof(kRawBytes));
727 CHECK_EQ(array->frame_size(), kFrameSize); 728 CHECK_EQ(array->frame_size(), kFrameSize);
729 CHECK_EQ(array->parameter_count(), kParameterCount);
728 CHECK_LE(array->address(), array->GetFirstBytecodeAddress()); 730 CHECK_LE(array->address(), array->GetFirstBytecodeAddress());
729 CHECK_GE(array->address() + array->BytecodeArraySize(), 731 CHECK_GE(array->address() + array->BytecodeArraySize(),
730 array->GetFirstBytecodeAddress() + array->length()); 732 array->GetFirstBytecodeAddress() + array->length());
731 for (int i = 0; i < kRawBytesSize; i++) { 733 for (int i = 0; i < kRawBytesSize; i++) {
732 CHECK_EQ(array->GetFirstBytecodeAddress()[i], kRawBytes[i]); 734 CHECK_EQ(array->GetFirstBytecodeAddress()[i], kRawBytes[i]);
733 CHECK_EQ(array->get(i), kRawBytes[i]); 735 CHECK_EQ(array->get(i), kRawBytes[i]);
734 } 736 }
735 737
736 // Full garbage collection 738 // Full garbage collection
737 heap->CollectAllGarbage(); 739 heap->CollectAllGarbage();
(...skipping 5828 matching lines...) Expand 10 before | Expand all | Expand 10 after
6566 { 6568 {
6567 SharedFunctionInfo::Iterator iterator(isolate); 6569 SharedFunctionInfo::Iterator iterator(isolate);
6568 while (iterator.Next()) sfi_count--; 6570 while (iterator.Next()) sfi_count--;
6569 } 6571 }
6570 6572
6571 CHECK_EQ(0, sfi_count); 6573 CHECK_EQ(0, sfi_count);
6572 } 6574 }
6573 6575
6574 } // namespace internal 6576 } // namespace internal
6575 } // namespace v8 6577 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/test-interpreter.cc ('k') | test/unittests/interpreter/bytecode-array-builder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698