Home | History | Annotate | Download | only in mips
      1 // 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 
     31 #include "frames-inl.h"
     32 #include "mips/assembler-mips-inl.h"
     33 
     34 namespace v8 {
     35 namespace internal {
     36 
     37 
     38 StackFrame::Type StackFrame::ComputeType(State* state) {
     39   ASSERT(state->fp != NULL);
     40   if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) {
     41     return ARGUMENTS_ADAPTOR;
     42   }
     43   // The marker and function offsets overlap. If the marker isn't a
     44   // smi then the frame is a JavaScript frame -- and the marker is
     45   // really the function.
     46   const int offset = StandardFrameConstants::kMarkerOffset;
     47   Object* marker = Memory::Object_at(state->fp + offset);
     48   if (!marker->IsSmi()) return JAVA_SCRIPT;
     49   return static_cast<StackFrame::Type>(Smi::cast(marker)->value());
     50 }
     51 
     52 
     53 StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) {
     54   if (fp == 0) return NONE;
     55   // Compute frame type and stack pointer.
     56   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   }
     63   // Fill in the state.
     64   state->sp = sp;
     65   state->fp = fp;
     66   state->pc_address = reinterpret_cast<Address*>(sp - 1 * kPointerSize);
     67   return EXIT;
     68 }
     69 
     70 
     71 void ExitFrame::Iterate(ObjectVisitor* v) const {
     72   // Do nothing
     73 }
     74 
     75 
     76 int JavaScriptFrame::GetProvidedParametersCount() const {
     77   return ComputeParametersCount();
     78 }
     79 
     80 
     81 Address JavaScriptFrame::GetCallerStackPointer() const {
     82   UNIMPLEMENTED_MIPS();
     83   return static_cast<Address>(NULL);  // UNIMPLEMENTED RETURN
     84 }
     85 
     86 
     87 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const {
     88   UNIMPLEMENTED_MIPS();
     89   return static_cast<Address>(NULL);  // UNIMPLEMENTED RETURN
     90 }
     91 
     92 
     93 Address InternalFrame::GetCallerStackPointer() const {
     94   UNIMPLEMENTED_MIPS();
     95   return static_cast<Address>(NULL);  // UNIMPLEMENTED RETURN
     96 }
     97 
     98 
     99 } }  // namespace v8::internal
    100 
    101