1) Call DeserializeScopeChain only if it's going to do something
non-trivial. And we only need to internalize the AstValueFactory in those cases.
2) BufferedUtf16CharacterStream::FillBuffer doesn't need the length
argument. The length is always kBufferSize and the subclasses can just read it
(it's protected).
R=rossberg@chromium.org
BUG=
Review URL: https://codereview.chromium.org/
381613003
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22307
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
FunctionLiteral* result = NULL;
{ Scope* scope = NewScope(scope_, GLOBAL_SCOPE);
info->SetGlobalScope(scope);
- if (!info->context().is_null()) {
+ if (!info->context().is_null() && !info->context()->IsNativeContext()) {
scope = Scope::DeserializeScopeChain(*info->context(), scope, zone());
// The Scope is backed up by ScopeInfo (which is in the V8 heap); this
// means the Parser cannot operate independent of the V8 heap. Tell the
if (buffer_cursor_ < buffer_end_) return true;
// Otherwise read a new block.
}
- unsigned length = FillBuffer(pos_, kBufferSize);
+ unsigned length = FillBuffer(pos_);
buffer_end_ = buffer_ + length;
return length > 0;
}
}
-unsigned GenericStringUtf16CharacterStream::FillBuffer(unsigned from_pos,
- unsigned length) {
+unsigned GenericStringUtf16CharacterStream::FillBuffer(unsigned from_pos) {
if (from_pos >= length_) return 0;
+ unsigned length = kBufferSize;
if (from_pos + length > length_) {
length = length_ - from_pos;
}
}
-unsigned Utf8ToUtf16CharacterStream::FillBuffer(unsigned char_position,
- unsigned length) {
+unsigned Utf8ToUtf16CharacterStream::FillBuffer(unsigned char_position) {
static const unibrow::uchar kMaxUtf16Character = 0xffff;
SetRawPosition(char_position);
if (raw_character_position_ != char_position) {
return 0u;
}
unsigned i = 0;
- while (i < length - 1) {
+ while (i < kBufferSize - 1) {
if (raw_data_pos_ == raw_data_length_) break;
unibrow::uchar c = raw_data_[raw_data_pos_];
if (c <= unibrow::Utf8::kMaxOneByteChar) {
virtual void SlowPushBack(uc16 character);
virtual unsigned BufferSeekForward(unsigned delta) = 0;
- virtual unsigned FillBuffer(unsigned position, unsigned length) = 0;
+ virtual unsigned FillBuffer(unsigned position) = 0;
const uc16* pushback_limit_;
uc16 buffer_[kBufferSize];
protected:
virtual unsigned BufferSeekForward(unsigned delta);
- virtual unsigned FillBuffer(unsigned position, unsigned length);
+ virtual unsigned FillBuffer(unsigned position);
Handle<String> string_;
unsigned length_;
protected:
virtual unsigned BufferSeekForward(unsigned delta);
- virtual unsigned FillBuffer(unsigned char_position, unsigned length);
+ virtual unsigned FillBuffer(unsigned char_position);
void SetRawPosition(unsigned char_position);
const byte* raw_data_;