1a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Copyright 2006-2008 the V8 project authors. All rights reserved.
2a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Redistribution and use in source and binary forms, with or without
3a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// modification, are permitted provided that the following conditions are
4a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// met:
5a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//
6a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//     * Redistributions of source code must retain the above copyright
7a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//       notice, this list of conditions and the following disclaimer.
8a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//     * Redistributions in binary form must reproduce the above
9a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//       copyright notice, this list of conditions and the following
10a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//       disclaimer in the documentation and/or other materials provided
11a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//       with the distribution.
12a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//     * Neither the name of Google Inc. nor the names of its
13a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//       contributors may be used to endorse or promote products derived
14a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//       from this software without specific prior written permission.
15a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block//
16a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
28a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#ifndef V8_MACRO_ASSEMBLER_H_
29a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#define V8_MACRO_ASSEMBLER_H_
30a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
31a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
32a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Helper types to make boolean flag easier to read at call-site.
33a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockenum InvokeFlag {
34a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block  CALL_FUNCTION,
35a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block  JUMP_FUNCTION
36a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block};
37a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
38a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
39a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockenum CodeLocation {
40a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block  IN_JAVASCRIPT,
41a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block  IN_JS_ENTRY,
42a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block  IN_C_ENTRY
43a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block};
44a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
45a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
46a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockenum HandlerType {
47a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block  TRY_CATCH_HANDLER,
48a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block  TRY_FINALLY_HANDLER,
49a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block  JS_ENTRY_HANDLER
50a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block};
51a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
52a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
53e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdoch// Types of uncatchable exceptions.
54e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdochenum UncatchableExceptionType {
55e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdoch  OUT_OF_MEMORY,
56e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdoch  TERMINATION
57e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdoch};
58e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdoch
59e0cee9b3ed82e2391fd85d118aeaa4ea361c687dBen Murdoch
60402d937239b0e2fd11bf2f4fe972ad78aa9fd481Andrei Popescu// Invalid depth in prototype chain.
61402d937239b0e2fd11bf2f4fe972ad78aa9fd481Andrei Popescuconst int kInvalidProtoDepth = -1;
62a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
63a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#if V8_TARGET_ARCH_IA32
64a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "assembler.h"
65a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "ia32/assembler-ia32.h"
66a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "ia32/assembler-ia32-inl.h"
67a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "code.h"  // must be after assembler_*.h
68a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "ia32/macro-assembler-ia32.h"
69a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#elif V8_TARGET_ARCH_X64
70a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "assembler.h"
71a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "x64/assembler-x64.h"
72a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "x64/assembler-x64-inl.h"
73a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "code.h"  // must be after assembler_*.h
74a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "x64/macro-assembler-x64.h"
75a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#elif V8_TARGET_ARCH_ARM
76a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "arm/constants-arm.h"
77a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "assembler.h"
78a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "arm/assembler-arm.h"
79a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "arm/assembler-arm-inl.h"
80a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "code.h"  // must be after assembler_*.h
81a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "arm/macro-assembler-arm.h"
823100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu#elif V8_TARGET_ARCH_MIPS
833100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu#include "mips/constants-mips.h"
843100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu#include "assembler.h"
853100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu#include "mips/assembler-mips.h"
863100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu#include "mips/assembler-mips-inl.h"
873100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu#include "code.h"  // must be after assembler_*.h
883100271588b61cbc1dc472a3f2f105d2eed8497fAndrei Popescu#include "mips/macro-assembler-mips.h"
89a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#else
90a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#error Unsupported target architecture.
91a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#endif
92a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block
9380d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsennamespace v8 {
9480d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsennamespace internal {
9580d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen
9680d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen// Support for "structured" code comments.
9780d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen#ifdef DEBUG
9880d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen
9980d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsenclass Comment {
10080d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen public:
10180d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen  Comment(MacroAssembler* masm, const char* msg);
10280d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen  ~Comment();
10380d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen
10480d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen private:
10580d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen  MacroAssembler* masm_;
10680d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen  const char* msg_;
10780d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen};
10880d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen
10980d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen#else
11080d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen
11180d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsenclass Comment {
11280d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen public:
11380d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen  Comment(MacroAssembler*, const char*)  {}
11480d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen};
11580d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen
11680d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen#endif  // DEBUG
11780d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen
11880d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen} }  // namespace v8::internal
11980d68eab642096c1a48b6474d6ec33064b0ad1f5Kristian Monsen
120a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#endif  // V8_MACRO_ASSEMBLER_H_
121