OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 static int sp_addr = 0; \ | 58 static int sp_addr = 0; \ |
59 do { \ | 59 do { \ |
60 ASM("mov x16, sp; str x16, %0" : "=g" (sp_addr)); \ | 60 ASM("mov x16, sp; str x16, %0" : "=g" (sp_addr)); \ |
61 } while (0) | 61 } while (0) |
62 #elif defined(__MIPSEB__) || defined(__MIPSEL__) | 62 #elif defined(__MIPSEB__) || defined(__MIPSEL__) |
63 #define GET_STACK_POINTER() \ | 63 #define GET_STACK_POINTER() \ |
64 static int sp_addr = 0; \ | 64 static int sp_addr = 0; \ |
65 do { \ | 65 do { \ |
66 ASM("sw $sp, %0" : "=g" (sp_addr)); \ | 66 ASM("sw $sp, %0" : "=g" (sp_addr)); \ |
67 } while (0) | 67 } while (0) |
| 68 #elif defined(__PPC64__) || defined(_ARCH_PPC64) |
| 69 #define GET_STACK_POINTER() \ |
| 70 static intptr_t sp_addr = 0; \ |
| 71 do { \ |
| 72 ASM("std 1, %0" : "=g"(sp_addr)); \ |
| 73 } while (0) |
| 74 #elif defined(__PPC__) || defined(_ARCH_PPC) |
| 75 #define GET_STACK_POINTER() \ |
| 76 static intptr_t sp_addr = 0; \ |
| 77 do { \ |
| 78 ASM("stw 1, %0" : "=g"(sp_addr)); \ |
| 79 } while (0) |
68 #else | 80 #else |
69 #error Host architecture was not detected as supported by v8 | 81 #error Host architecture was not detected as supported by v8 |
70 #endif | 82 #endif |
71 | 83 |
72 void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) { | 84 void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) { |
73 GET_STACK_POINTER(); | 85 GET_STACK_POINTER(); |
74 args.GetReturnValue().Set(v8_num(sp_addr)); | 86 args.GetReturnValue().Set(v8_num(sp_addr)); |
75 } | 87 } |
76 | 88 |
77 | 89 |
(...skipping 15 matching lines...) Expand all Loading... |
93 v8::Local<v8::Function> foo = | 105 v8::Local<v8::Function> foo = |
94 v8::Local<v8::Function>::Cast(global_object->Get(v8_str("foo"))); | 106 v8::Local<v8::Function>::Cast(global_object->Get(v8_str("foo"))); |
95 | 107 |
96 v8::Local<v8::Value> result = foo->Call(global_object, 0, NULL); | 108 v8::Local<v8::Value> result = foo->Call(global_object, 0, NULL); |
97 CHECK_EQ(0, result->Int32Value() % v8::base::OS::ActivationFrameAlignment()); | 109 CHECK_EQ(0, result->Int32Value() % v8::base::OS::ActivationFrameAlignment()); |
98 } | 110 } |
99 | 111 |
100 #undef GET_STACK_POINTERS | 112 #undef GET_STACK_POINTERS |
101 #undef ASM | 113 #undef ASM |
102 #endif // __GNUC__ | 114 #endif // __GNUC__ |
OLD | NEW |