diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/JavaScriptCore/bytecode/CodeOrigin.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/JavaScriptCore/bytecode/CodeOrigin.cpp')
-rw-r--r-- | Source/JavaScriptCore/bytecode/CodeOrigin.cpp | 132 |
1 files changed, 53 insertions, 79 deletions
diff --git a/Source/JavaScriptCore/bytecode/CodeOrigin.cpp b/Source/JavaScriptCore/bytecode/CodeOrigin.cpp index d51695012..39b83fead 100644 --- a/Source/JavaScriptCore/bytecode/CodeOrigin.cpp +++ b/Source/JavaScriptCore/bytecode/CodeOrigin.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2015 Apple Inc. All rights reserved. + * Copyright (C) 2012, 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -29,15 +29,14 @@ #include "CallFrame.h" #include "CodeBlock.h" #include "Executable.h" -#include "InlineCallFrame.h" -#include "JSCInlines.h" +#include "Operations.h" namespace JSC { unsigned CodeOrigin::inlineDepthForCallFrame(InlineCallFrame* inlineCallFrame) { unsigned result = 1; - for (InlineCallFrame* current = inlineCallFrame; current; current = current->directCaller.inlineCallFrame) + for (InlineCallFrame* current = inlineCallFrame; current; current = current->caller.inlineCallFrame) result++; return result; } @@ -46,90 +45,18 @@ unsigned CodeOrigin::inlineDepth() const { return inlineDepthForCallFrame(inlineCallFrame); } - -bool CodeOrigin::isApproximatelyEqualTo(const CodeOrigin& other) const -{ - CodeOrigin a = *this; - CodeOrigin b = other; - - if (!a.isSet()) - return !b.isSet(); - if (!b.isSet()) - return false; - - if (a.isHashTableDeletedValue()) - return b.isHashTableDeletedValue(); - if (b.isHashTableDeletedValue()) - return false; - for (;;) { - ASSERT(a.isSet()); - ASSERT(b.isSet()); - - if (a.bytecodeIndex != b.bytecodeIndex) - return false; - - if ((!!a.inlineCallFrame) != (!!b.inlineCallFrame)) - return false; - - if (!a.inlineCallFrame) - return true; - - if (a.inlineCallFrame->baselineCodeBlock.get() != b.inlineCallFrame->baselineCodeBlock.get()) - return false; - - a = a.inlineCallFrame->directCaller; - b = b.inlineCallFrame->directCaller; - } -} - -unsigned CodeOrigin::approximateHash() const -{ - if (!isSet()) - return 0; - if (isHashTableDeletedValue()) - return 1; - - unsigned result = 2; - CodeOrigin codeOrigin = *this; - for (;;) { - result += codeOrigin.bytecodeIndex; - - if (!codeOrigin.inlineCallFrame) - return result; - - result += WTF::PtrHash<JSCell*>::hash(codeOrigin.inlineCallFrame->baselineCodeBlock.get()); - - codeOrigin = codeOrigin.inlineCallFrame->directCaller; - } -} - Vector<CodeOrigin> CodeOrigin::inlineStack() const { Vector<CodeOrigin> result(inlineDepth()); result.last() = *this; unsigned index = result.size() - 2; - for (InlineCallFrame* current = inlineCallFrame; current; current = current->directCaller.inlineCallFrame) - result[index--] = current->directCaller; + for (InlineCallFrame* current = inlineCallFrame; current; current = current->caller.inlineCallFrame) + result[index--] = current->caller; RELEASE_ASSERT(!result[0].inlineCallFrame); return result; } -CodeBlock* CodeOrigin::codeOriginOwner() const -{ - if (!inlineCallFrame) - return 0; - return inlineCallFrame->baselineCodeBlock.get(); -} - -int CodeOrigin::stackOffset() const -{ - if (!inlineCallFrame) - return 0; - - return inlineCallFrame->stackOffset; -} - void CodeOrigin::dump(PrintStream& out) const { if (!isSet()) { @@ -143,7 +70,7 @@ void CodeOrigin::dump(PrintStream& out) const out.print(" --> "); if (InlineCallFrame* frame = stack[i].inlineCallFrame) { - out.print(frame->briefFunctionInformation(), ":<", RawPointer(frame->baselineCodeBlock.get()), "> "); + out.print(frame->briefFunctionInformation(), ":<", RawPointer(frame->executable.get()), "> "); if (frame->isClosureCall) out.print("(closure) "); } @@ -157,4 +84,51 @@ void CodeOrigin::dumpInContext(PrintStream& out, DumpContext*) const dump(out); } +JSFunction* InlineCallFrame::calleeForCallFrame(ExecState* exec) const +{ + return jsCast<JSFunction*>(calleeRecovery.recover(exec)); +} + +CodeBlockHash InlineCallFrame::hash() const +{ + return jsCast<FunctionExecutable*>(executable.get())->codeBlockFor( + specializationKind())->hash(); +} + +CString InlineCallFrame::inferredName() const +{ + return jsCast<FunctionExecutable*>(executable.get())->inferredName().utf8(); +} + +CodeBlock* InlineCallFrame::baselineCodeBlock() const +{ + return jsCast<FunctionExecutable*>(executable.get())->baselineCodeBlockFor(specializationKind()); +} + +void InlineCallFrame::dumpBriefFunctionInformation(PrintStream& out) const +{ + out.print(inferredName(), "#", hash()); +} + +void InlineCallFrame::dumpInContext(PrintStream& out, DumpContext* context) const +{ + out.print(briefFunctionInformation(), ":<", RawPointer(executable.get())); + if (executable->isStrictMode()) + out.print(" (StrictMode)"); + out.print(", bc#", caller.bytecodeIndex, ", ", specializationKind()); + if (isClosureCall) + out.print(", closure call"); + else + out.print(", known callee: ", inContext(calleeRecovery.constant(), context)); + out.print(", numArgs+this = ", arguments.size()); + out.print(", stack < loc", VirtualRegister(stackOffset).toLocal()); + out.print(">"); +} + +void InlineCallFrame::dump(PrintStream& out) const +{ + dumpInContext(out, 0); +} + } // namespace JSC + |