blob: d6305629951fc34e56d307f941276ae2329fd2a8 [file] [log] [blame]
Andrei Popescu31002712010-02-23 13:46:05 +00001// Copyright 2010 the V8 project authors. All rights reserved.
2// Redistribution and use in source and binary forms, with or without
3// modification, are permitted provided that the following conditions are
4// met:
5//
6// * Redistributions of source code must retain the above copyright
7// notice, this list of conditions and the following disclaimer.
8// * Redistributions in binary form must reproduce the above
9// copyright notice, this list of conditions and the following
10// disclaimer in the documentation and/or other materials provided
11// with the distribution.
12// * Neither the name of Google Inc. nor the names of its
13// contributors may be used to endorse or promote products derived
14// from this software without specific prior written permission.
15//
16// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
29#include "v8.h"
30
Leon Clarkef7060e22010-06-03 12:02:55 +010031#if defined(V8_TARGET_ARCH_MIPS)
32
Andrei Popescu31002712010-02-23 13:46:05 +000033#include "frames-inl.h"
34#include "mips/assembler-mips-inl.h"
35
36namespace v8 {
37namespace internal {
38
39
40StackFrame::Type StackFrame::ComputeType(State* state) {
41 ASSERT(state->fp != NULL);
42 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) {
43 return ARGUMENTS_ADAPTOR;
44 }
45 // The marker and function offsets overlap. If the marker isn't a
46 // smi then the frame is a JavaScript frame -- and the marker is
47 // really the function.
48 const int offset = StandardFrameConstants::kMarkerOffset;
49 Object* marker = Memory::Object_at(state->fp + offset);
50 if (!marker->IsSmi()) return JAVA_SCRIPT;
51 return static_cast<StackFrame::Type>(Smi::cast(marker)->value());
52}
53
54
Kristian Monsen0d5e1162010-09-30 15:31:59 +010055Address ExitFrame::ComputeStackPointer(Address fp) {
Andrei Popescu31002712010-02-23 13:46:05 +000056 Address sp = fp + ExitFrameConstants::kSPDisplacement;
57 const int offset = ExitFrameConstants::kCodeOffset;
58 Object* code = Memory::Object_at(fp + offset);
59 bool is_debug_exit = code->IsSmi();
60 if (is_debug_exit) {
61 sp -= kNumJSCallerSaved * kPointerSize;
62 }
Kristian Monsen0d5e1162010-09-30 15:31:59 +010063 return sp;
Andrei Popescu31002712010-02-23 13:46:05 +000064}
65
66
67void ExitFrame::Iterate(ObjectVisitor* v) const {
68 // Do nothing
69}
70
71
72int JavaScriptFrame::GetProvidedParametersCount() const {
73 return ComputeParametersCount();
74}
75
76
77Address JavaScriptFrame::GetCallerStackPointer() const {
78 UNIMPLEMENTED_MIPS();
79 return static_cast<Address>(NULL); // UNIMPLEMENTED RETURN
80}
81
82
83Address ArgumentsAdaptorFrame::GetCallerStackPointer() const {
84 UNIMPLEMENTED_MIPS();
85 return static_cast<Address>(NULL); // UNIMPLEMENTED RETURN
86}
87
88
89Address InternalFrame::GetCallerStackPointer() const {
Steve Block6ded16b2010-05-10 14:33:55 +010090 return fp() + StandardFrameConstants::kCallerSPOffset;
Andrei Popescu31002712010-02-23 13:46:05 +000091}
92
93
94} } // namespace v8::internal
95
Leon Clarkef7060e22010-06-03 12:02:55 +010096#endif // V8_TARGET_ARCH_MIPS