Commit 6c5c8238 authored by vitalyr@chromium.org's avatar vitalyr@chromium.org

Support placement new syntax for zone objects and start using it in the parser.

Review URL: http://codereview.chromium.org/6771058

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7489 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d37b5750
This diff is collapsed.
...@@ -280,6 +280,9 @@ class RegExpBuilder: public ZoneObject { ...@@ -280,6 +280,9 @@ class RegExpBuilder: public ZoneObject {
void FlushCharacters(); void FlushCharacters();
void FlushText(); void FlushText();
void FlushTerms(); void FlushTerms();
Zone* zone() { return zone_; }
Zone* zone_;
bool pending_empty_; bool pending_empty_;
ZoneList<uc16>* characters_; ZoneList<uc16>* characters_;
BufferedZoneList<RegExpTree, 2> terms_; BufferedZoneList<RegExpTree, 2> terms_;
...@@ -389,6 +392,7 @@ class RegExpParser { ...@@ -389,6 +392,7 @@ class RegExpParser {
}; };
Isolate* isolate() { return isolate_; } Isolate* isolate() { return isolate_; }
Zone* zone() { return isolate_->zone(); }
uc32 current() { return current_; } uc32 current() { return current_; }
bool has_more() { return has_more_; } bool has_more() { return has_more_; }
...@@ -453,6 +457,7 @@ class Parser { ...@@ -453,6 +457,7 @@ class Parser {
}; };
Isolate* isolate() { return isolate_; } Isolate* isolate() { return isolate_; }
Zone* zone() { return isolate_->zone(); }
// Called by ParseProgram after setting up the scanner. // Called by ParseProgram after setting up the scanner.
FunctionLiteral* DoParseProgram(Handle<String> source, FunctionLiteral* DoParseProgram(Handle<String> source,
......
...@@ -97,6 +97,10 @@ void* ZoneObject::operator new(size_t size) { ...@@ -97,6 +97,10 @@ void* ZoneObject::operator new(size_t size) {
return ZONE->New(static_cast<int>(size)); return ZONE->New(static_cast<int>(size));
} }
void* ZoneObject::operator new(size_t size, Zone* zone) {
return zone->New(static_cast<int>(size));
}
inline void* ZoneListAllocationPolicy::New(int size) { inline void* ZoneListAllocationPolicy::New(int size) {
return ZONE->New(size); return ZONE->New(size);
......
...@@ -133,6 +133,7 @@ class ZoneObject { ...@@ -133,6 +133,7 @@ class ZoneObject {
public: public:
// Allocate a new ZoneObject of 'size' bytes in the Zone. // Allocate a new ZoneObject of 'size' bytes in the Zone.
inline void* operator new(size_t size); inline void* operator new(size_t size);
inline void* operator new(size_t size, Zone* zone);
// Ideally, the delete operator should be private instead of // Ideally, the delete operator should be private instead of
// public, but unfortunately the compiler sometimes synthesizes // public, but unfortunately the compiler sometimes synthesizes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment