2012-05-22 14:05:44 +00:00
|
|
|
// Copyright 2012 the V8 project authors. All rights reserved.
|
2009-05-04 07:16:10 +00:00
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following
|
|
|
|
// disclaimer in the documentation and/or other materials provided
|
|
|
|
// with the distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the names of its
|
|
|
|
// contributors may be used to endorse or promote products derived
|
|
|
|
// from this software without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2009-05-06 13:27:35 +00:00
|
|
|
#ifndef V8_X64_SIMULATOR_X64_H_
|
|
|
|
#define V8_X64_SIMULATOR_X64_H_
|
|
|
|
|
2009-10-01 10:33:05 +00:00
|
|
|
#include "allocation.h"
|
2009-05-06 13:27:35 +00:00
|
|
|
|
2010-10-25 16:40:41 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
|
|
|
// Since there is no simulator for the x64 architecture the only thing we can
|
2009-05-06 13:27:35 +00:00
|
|
|
// do is to call the entry directly.
|
2009-06-10 09:48:15 +00:00
|
|
|
// TODO(X64): Don't pass p0, since it isn't used?
|
2009-05-06 13:27:35 +00:00
|
|
|
#define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \
|
2010-10-25 16:40:41 +00:00
|
|
|
(entry(p0, p1, p2, p3, p4))
|
|
|
|
|
2011-02-16 09:18:19 +00:00
|
|
|
typedef int (*regexp_matcher)(String*, int, const byte*,
|
2012-05-22 14:05:44 +00:00
|
|
|
const byte*, int*, int, Address, int, Isolate*);
|
2011-02-16 09:18:19 +00:00
|
|
|
|
|
|
|
// Call the generated regexp code directly. The code at the entry address should
|
2011-03-18 20:35:07 +00:00
|
|
|
// expect eight int/pointer sized arguments and return an int.
|
2012-05-22 14:05:44 +00:00
|
|
|
#define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \
|
|
|
|
(FUNCTION_CAST<regexp_matcher>(entry)(p0, p1, p2, p3, p4, p5, p6, p7, p8))
|
2010-10-25 16:40:41 +00:00
|
|
|
|
|
|
|
#define TRY_CATCH_FROM_ADDRESS(try_catch_address) \
|
|
|
|
(reinterpret_cast<TryCatch*>(try_catch_address))
|
2009-05-06 13:27:35 +00:00
|
|
|
|
2009-10-01 10:33:05 +00:00
|
|
|
// The stack limit beyond which we will throw stack overflow errors in
|
|
|
|
// generated code. Because generated code on x64 uses the C stack, we
|
|
|
|
// just use the C stack limit.
|
|
|
|
class SimulatorStack : public v8::internal::AllStatic {
|
|
|
|
public:
|
2011-05-05 18:55:31 +00:00
|
|
|
static inline uintptr_t JsLimitFromCLimit(Isolate* isolate,
|
|
|
|
uintptr_t c_limit) {
|
2009-10-01 10:33:05 +00:00
|
|
|
return c_limit;
|
|
|
|
}
|
2009-11-05 13:27:21 +00:00
|
|
|
|
|
|
|
static inline uintptr_t RegisterCTryCatch(uintptr_t try_catch_address) {
|
|
|
|
return try_catch_address;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void UnregisterCTryCatch() { }
|
2009-10-01 10:33:05 +00:00
|
|
|
};
|
2009-05-06 13:27:35 +00:00
|
|
|
|
2010-10-25 16:40:41 +00:00
|
|
|
} } // namespace v8::internal
|
2009-11-05 13:27:21 +00:00
|
|
|
|
2009-05-06 13:27:35 +00:00
|
|
|
#endif // V8_X64_SIMULATOR_X64_H_
|