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

Side by Side Diff: src/frames-arm.cc

Issue 1930: Adapt to new calling convention on ARM. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 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 | Annotate | Revision Log
« no previous file with comments | « src/frames-arm.h ('k') | src/globals.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 18 matching lines...) Expand all
29 29
30 #include "frames-inl.h" 30 #include "frames-inl.h"
31 #include "assembler-arm-inl.h" 31 #include "assembler-arm-inl.h"
32 32
33 33
34 namespace v8 { namespace internal { 34 namespace v8 { namespace internal {
35 35
36 36
37 StackFrame::Type StackFrame::ComputeType(State* state) { 37 StackFrame::Type StackFrame::ComputeType(State* state) {
38 ASSERT(state->fp != NULL); 38 ASSERT(state->fp != NULL);
39 if (state->pp == NULL) { 39 if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) {
40 if (Memory::Address_at(state->fp +
41 EntryFrameConstants::kConstructMarkOffset) != 0) {
42 return ENTRY_CONSTRUCT;
43 } else {
44 return ENTRY;
45 }
46 } else if (StandardFrame::IsArgumentsAdaptorFrame(state->fp)) {
47 return ARGUMENTS_ADAPTOR; 40 return ARGUMENTS_ADAPTOR;
48 } else if (
49 Memory::Object_at(state->fp +
50 StandardFrameConstants::kFunctionOffset)->IsSmi()) {
51 return INTERNAL;
52 } else {
53 return JAVA_SCRIPT;
54 } 41 }
42 // The marker and function offsets overlap. If the marker isn't a
43 // smi then the frame is a JavaScript frame -- and the marker is
44 // really the function.
45 const int offset = StandardFrameConstants::kMarkerOffset;
46 Object* marker = Memory::Object_at(state->fp + offset);
47 if (!marker->IsSmi()) return JAVA_SCRIPT;
48 return static_cast<StackFrame::Type>(Smi::cast(marker)->value());
55 } 49 }
56 50
57 51
58 StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) { 52 StackFrame::Type ExitFrame::GetStateForFramePointer(Address fp, State* state) {
59 if (fp == 0) return NONE; 53 if (fp == 0) return NONE;
60 // Compute frame type and stack pointer. 54 // Compute frame type and stack pointer.
61 Address sp = fp + ExitFrameConstants::kSPDisplacement; 55 Address sp = fp + ExitFrameConstants::kSPDisplacement;
62 Type type; 56 Type type;
63 if (Memory::Address_at(fp + ExitFrameConstants::kDebugMarkOffset) != 0) { 57 if (Memory::Address_at(fp + ExitFrameConstants::kDebugMarkOffset) != 0) {
64 type = EXIT_DEBUG; 58 type = EXIT_DEBUG;
65 sp -= kNumJSCallerSaved * kPointerSize; 59 sp -= kNumJSCallerSaved * kPointerSize;
66 } else { 60 } else {
67 type = EXIT; 61 type = EXIT;
68 } 62 }
69 // Fill in the state. 63 // Fill in the state.
70 state->sp = sp; 64 state->sp = sp;
71 state->fp = fp; 65 state->fp = fp;
72 state->pp = fp + ExitFrameConstants::kPPDisplacement;
73 state->pc_address = reinterpret_cast<Address*>(sp - 1 * kPointerSize); 66 state->pc_address = reinterpret_cast<Address*>(sp - 1 * kPointerSize);
74 return type; 67 return type;
75 } 68 }
76 69
77 70
78 void ExitFrame::Iterate(ObjectVisitor* v) const { 71 void ExitFrame::Iterate(ObjectVisitor* v) const {
79 // Do nothing 72 // Do nothing
80 } 73 }
81 74
82 75
83 int JavaScriptFrame::GetProvidedParametersCount() const { 76 int JavaScriptFrame::GetProvidedParametersCount() const {
84 const int offset = JavaScriptFrameConstants::kArgsLengthOffset; 77 return ComputeParametersCount();
85 int result = Memory::int_at(fp() + offset);
86 // We never remove extra parameters provided on the stack; we only
87 // fill in undefined values for parameters not provided.
88 ASSERT(0 <= result && result <= ComputeParametersCount());
89 return result;
90 } 78 }
91 79
92 80
93 Address JavaScriptFrame::GetCallerStackPointer() const { 81 Address JavaScriptFrame::GetCallerStackPointer() const {
94 return state_.pp; 82 int arguments;
83 if (Heap::gc_state() != Heap::NOT_IN_GC) {
84 // The arguments for cooked frames are traversed as if they were
85 // expression stack elements of the calling frame. The reason for
86 // this rather strange decision is that we cannot access the
87 // function during mark-compact GCs when the stack is cooked.
88 // In fact accessing heap objects (like function->shared() below)
89 // at all during GC is problematic.
90 arguments = 0;
91 } else {
92 // Compute the number of arguments by getting the number of formal
93 // parameters of the function. We must remember to take the
94 // receiver into account (+1).
95 JSFunction* function = JSFunction::cast(this->function());
96 arguments = function->shared()->formal_parameter_count() + 1;
97 }
98 const int offset = StandardFrameConstants::kCallerSPOffset;
99 return fp() + offset + (arguments * kPointerSize);
95 } 100 }
96 101
97 102
98 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const { 103 Address ArgumentsAdaptorFrame::GetCallerStackPointer() const {
99 // Argument adaptor frames aren't used on ARM (yet). 104 const int arguments = Smi::cast(GetExpression(0))->value();
100 UNIMPLEMENTED(); 105 const int offset = StandardFrameConstants::kCallerSPOffset;
101 return 0; 106 return fp() + offset + (arguments + 1) * kPointerSize;
102 } 107 }
103 108
104 109
105 Address InternalFrame::GetCallerStackPointer() const { 110 Address InternalFrame::GetCallerStackPointer() const {
106 return state_.pp; 111 // Internal frames have no arguments. The stack pointer of the
112 // caller is at a fixed offset from the frame pointer.
113 return fp() + StandardFrameConstants::kCallerSPOffset;
107 } 114 }
108 115
109 116
110 Code* JavaScriptFrame::FindCode() const { 117 Code* JavaScriptFrame::FindCode() const {
111 const int offset = StandardFrameConstants::kCodeOffset; 118 JSFunction* function = JSFunction::cast(this->function());
112 Object* code = Memory::Object_at(fp() + offset); 119 return function->shared()->code();
113 if (code == NULL) {
114 // The code object isn't set; find it and set it.
115 code = Heap::FindCodeObject(pc());
116 ASSERT(!code->IsFailure());
117 Memory::Object_at(fp() + offset) = code;
118 }
119 ASSERT(code != NULL);
120 return Code::cast(code);
121 } 120 }
122 121
123 122
124 } } // namespace v8::internal 123 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames-arm.h ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698