OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3518 | 3518 |
3519 | 3519 |
3520 // Builtins global object which holds the runtime routines written in | 3520 // Builtins global object which holds the runtime routines written in |
3521 // JavaScript. | 3521 // JavaScript. |
3522 class JSBuiltinsObject: public GlobalObject { | 3522 class JSBuiltinsObject: public GlobalObject { |
3523 public: | 3523 public: |
3524 // Accessors for the runtime routines written in JavaScript. | 3524 // Accessors for the runtime routines written in JavaScript. |
3525 inline Object* javascript_builtin(Builtins::JavaScript id); | 3525 inline Object* javascript_builtin(Builtins::JavaScript id); |
3526 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value); | 3526 inline void set_javascript_builtin(Builtins::JavaScript id, Object* value); |
3527 | 3527 |
| 3528 // Accessors for code of the runtime routines written in JavaScript. |
| 3529 inline Code* javascript_builtin_code(Builtins::JavaScript id); |
| 3530 inline void set_javascript_builtin_code(Builtins::JavaScript id, Code* value); |
| 3531 |
3528 // Casting. | 3532 // Casting. |
3529 static inline JSBuiltinsObject* cast(Object* obj); | 3533 static inline JSBuiltinsObject* cast(Object* obj); |
3530 | 3534 |
3531 // Dispatched behavior. | 3535 // Dispatched behavior. |
3532 #ifdef DEBUG | 3536 #ifdef DEBUG |
3533 void JSBuiltinsObjectPrint(); | 3537 void JSBuiltinsObjectPrint(); |
3534 void JSBuiltinsObjectVerify(); | 3538 void JSBuiltinsObjectVerify(); |
3535 #endif | 3539 #endif |
3536 | 3540 |
3537 // Layout description. The size of the builtins object includes | 3541 // Layout description. The size of the builtins object includes |
3538 // room for one pointer per runtime routine written in javascript. | 3542 // room for two pointers per runtime routine written in javascript |
| 3543 // (function and code object). |
3539 static const int kJSBuiltinsCount = Builtins::id_count; | 3544 static const int kJSBuiltinsCount = Builtins::id_count; |
3540 static const int kJSBuiltinsOffset = GlobalObject::kHeaderSize; | 3545 static const int kJSBuiltinsOffset = GlobalObject::kHeaderSize; |
| 3546 static const int kJSBuiltinsCodeOffset = |
| 3547 GlobalObject::kHeaderSize + (kJSBuiltinsCount * kPointerSize); |
3541 static const int kSize = | 3548 static const int kSize = |
3542 kJSBuiltinsOffset + (kJSBuiltinsCount * kPointerSize); | 3549 kJSBuiltinsCodeOffset + (kJSBuiltinsCount * kPointerSize); |
| 3550 |
| 3551 static int OffsetOfFunctionWithId(Builtins::JavaScript id) { |
| 3552 return kJSBuiltinsOffset + id * kPointerSize; |
| 3553 } |
| 3554 |
| 3555 static int OffsetOfCodeWithId(Builtins::JavaScript id) { |
| 3556 return kJSBuiltinsCodeOffset + id * kPointerSize; |
| 3557 } |
| 3558 |
3543 private: | 3559 private: |
3544 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBuiltinsObject); | 3560 DISALLOW_IMPLICIT_CONSTRUCTORS(JSBuiltinsObject); |
3545 }; | 3561 }; |
3546 | 3562 |
3547 | 3563 |
3548 // Representation for JS Wrapper objects, String, Number, Boolean, Date, etc. | 3564 // Representation for JS Wrapper objects, String, Number, Boolean, Date, etc. |
3549 class JSValue: public JSObject { | 3565 class JSValue: public JSObject { |
3550 public: | 3566 public: |
3551 // [value]: the object being wrapped. | 3567 // [value]: the object being wrapped. |
3552 DECL_ACCESSORS(value, Object) | 3568 DECL_ACCESSORS(value, Object) |
(...skipping 1528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5081 } else { | 5097 } else { |
5082 value &= ~(1 << bit_position); | 5098 value &= ~(1 << bit_position); |
5083 } | 5099 } |
5084 return value; | 5100 return value; |
5085 } | 5101 } |
5086 }; | 5102 }; |
5087 | 5103 |
5088 } } // namespace v8::internal | 5104 } } // namespace v8::internal |
5089 | 5105 |
5090 #endif // V8_OBJECTS_H_ | 5106 #endif // V8_OBJECTS_H_ |
OLD | NEW |