1// Copyright 2016 the V8 project authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5// Load implementations from <project root>/tools. 6// Files: tools/splaytree.js tools/codemap.js tools/csvparser.js 7// Files: tools/consarray.js tools/profile.js tools/profile_view.js 8// Files: tools/logreader.js tools/tickprocessor.js 9// Files: tools/dumpcpp.js 10// Env: TEST_FILE_NAME 11 12(function testProcessSharedLibrary() { 13 var oldLoadSymbols = UnixCppEntriesProvider.prototype.loadSymbols; 14 15 UnixCppEntriesProvider.prototype.loadSymbols = function(libName) { 16 this.symbols = [[ 17 '00000100 00000001 t v8::internal::Runtime_StringReplaceRegExpWithString(v8::internal::Arguments)', 18 '00000110 00000001 T v8::internal::Runtime::GetElementOrCharAt(v8::internal::Handle<v8::internal::Object>, unsigned int)', 19 '00000120 00000001 t v8::internal::Runtime_DebugGetPropertyDetails(v8::internal::Arguments)', 20 '00000130 00000001 W v8::internal::RegExpMacroAssembler::CheckPosition(int, v8::internal::Label*)' 21 ].join('\n'), '']; 22 }; 23 24 var testCppProcessor = new CppProcessor(new UnixCppEntriesProvider(), 25 false, false); 26 testCppProcessor.processSharedLibrary( 27 '/usr/local/google/home/lpy/v8/out/native/d8', 28 0x00000100, 0x00000400, 0); 29 30 var staticEntries = testCppProcessor.codeMap_.getAllStaticEntriesWithAddresses(); 31 var total = staticEntries.length; 32 assertEquals(total, 3); 33 assertEquals(staticEntries[0], 34 [288,{size:1, 35 name:'v8::internal::Runtime_DebugGetPropertyDetails(v8::internal::Arguments)', 36 type:'CPP', 37 nameUpdated_:false} 38 ]); 39 assertEquals(staticEntries[1], 40 [272,{size:1, 41 name:'v8::internal::Runtime::GetElementOrCharAt(v8::internal::Handle<v8::internal::Object>, unsigned int)', 42 type:'CPP', 43 nameUpdated_:false} 44 ]); 45 assertEquals(staticEntries[2], 46 [256,{size:1, 47 name:'v8::internal::Runtime_StringReplaceRegExpWithString(v8::internal::Arguments)', 48 type:'CPP', 49 nameUpdated_:false} 50 ]); 51 52 UnixCppEntriesProvider.prototype.loadSymbols = oldLoadSymbols; 53})(); 54