summaryrefslogtreecommitdiff
path: root/deps/v8/src/json-parser.h
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2014-09-29 13:20:04 +0400
committerFedor Indutny <fedor@indutny.com>2014-10-08 15:44:38 +0400
commit9116b240c924d37627313416b7ee038d0580afbc (patch)
tree86c586915a96d308b1b04de679a8ae293caf3e41 /deps/v8/src/json-parser.h
parenta2a3fd48934f36d94575dd33d2a2cb732f937f77 (diff)
downloadnode-9116b240c924d37627313416b7ee038d0580afbc.tar.gz
deps: update v8 to 3.28.73
Reviewed-By: Fedor Indutny <fedor@indutny.com> PR-URL: https://github.com/joyent/node/pull/8476
Diffstat (limited to 'deps/v8/src/json-parser.h')
-rw-r--r--deps/v8/src/json-parser.h55
1 files changed, 28 insertions, 27 deletions
diff --git a/deps/v8/src/json-parser.h b/deps/v8/src/json-parser.h
index f3017784b..c23e50dbb 100644
--- a/deps/v8/src/json-parser.h
+++ b/deps/v8/src/json-parser.h
@@ -5,13 +5,13 @@
#ifndef V8_JSON_PARSER_H_
#define V8_JSON_PARSER_H_
-#include "v8.h"
+#include "src/v8.h"
-#include "char-predicates-inl.h"
-#include "conversions.h"
-#include "messages.h"
-#include "spaces-inl.h"
-#include "token.h"
+#include "src/char-predicates-inl.h"
+#include "src/conversions.h"
+#include "src/heap/spaces-inl.h"
+#include "src/messages.h"
+#include "src/token.h"
namespace v8 {
namespace internal {
@@ -104,7 +104,7 @@ class JsonParser BASE_EMBEDDED {
DisallowHeapAllocation no_gc;
String::FlatContent content = expected->GetFlatContent();
if (content.IsAscii()) {
- ASSERT_EQ('"', c0_);
+ DCHECK_EQ('"', c0_);
const uint8_t* input_chars = seq_source_->GetChars() + position_ + 1;
const uint8_t* expected_chars = content.ToOneByteVector().start();
for (int i = 0; i < length; i++) {
@@ -300,7 +300,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
factory()->NewJSObject(object_constructor(), pretenure_);
Handle<Map> map(json_object->map());
ZoneList<Handle<Object> > properties(8, zone());
- ASSERT_EQ(c0_, '{');
+ DCHECK_EQ(c0_, '{');
bool transitioning = true;
@@ -358,19 +358,19 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
bool follow_expected = false;
Handle<Map> target;
if (seq_ascii) {
- key = JSObject::ExpectedTransitionKey(map);
+ key = Map::ExpectedTransitionKey(map);
follow_expected = !key.is_null() && ParseJsonString(key);
}
// If the expected transition hits, follow it.
if (follow_expected) {
- target = JSObject::ExpectedTransitionTarget(map);
+ target = Map::ExpectedTransitionTarget(map);
} else {
// If the expected transition failed, parse an internalized string and
// try to find a matching transition.
key = ParseJsonInternalizedString();
if (key.is_null()) return ReportUnexpectedCharacter();
- target = JSObject::FindTransitionToField(map, key);
+ target = Map::FindTransitionToField(map, key);
// If a transition was found, follow it and continue.
transitioning = !target.is_null();
}
@@ -387,11 +387,9 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
Representation expected_representation = details.representation();
if (value->FitsRepresentation(expected_representation)) {
- // If the target representation is double and the value is already
- // double, use the existing box.
- if (value->IsSmi() && expected_representation.IsDouble()) {
- value = factory()->NewHeapNumber(
- Handle<Smi>::cast(value)->value());
+ if (expected_representation.IsDouble()) {
+ value = Object::NewStorageFor(isolate(), value,
+ expected_representation);
} else if (expected_representation.IsHeapObject() &&
!target->instance_descriptors()->GetFieldType(
descriptor)->NowContains(value)) {
@@ -399,7 +397,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
isolate(), expected_representation));
Map::GeneralizeFieldType(target, descriptor, value_type);
}
- ASSERT(target->instance_descriptors()->GetFieldType(
+ DCHECK(target->instance_descriptors()->GetFieldType(
descriptor)->NowContains(value));
properties.Add(value, zone());
map = target;
@@ -414,7 +412,8 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
int length = properties.length();
for (int i = 0; i < length; i++) {
Handle<Object> value = properties[i];
- json_object->FastPropertyAtPut(i, *value);
+ FieldIndex index = FieldIndex::ForPropertyIndex(*map, i);
+ json_object->FastPropertyAtPut(index, *value);
}
} else {
key = ParseJsonInternalizedString();
@@ -425,7 +424,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
if (value.is_null()) return ReportUnexpectedCharacter();
}
- JSObject::SetLocalPropertyIgnoreAttributes(
+ JSObject::SetOwnPropertyIgnoreAttributes(
json_object, key, value, NONE).Assert();
} while (MatchSkipWhiteSpace(','));
if (c0_ != '}') {
@@ -438,7 +437,8 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
int length = properties.length();
for (int i = 0; i < length; i++) {
Handle<Object> value = properties[i];
- json_object->FastPropertyAtPut(i, *value);
+ FieldIndex index = FieldIndex::ForPropertyIndex(*map, i);
+ json_object->FastPropertyAtPut(index, *value);
}
}
}
@@ -451,7 +451,7 @@ template <bool seq_ascii>
Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() {
HandleScope scope(isolate());
ZoneList<Handle<Object> > elements(4, zone());
- ASSERT_EQ(c0_, '[');
+ DCHECK_EQ(c0_, '[');
AdvanceSkipWhitespace();
if (c0_ != ']') {
@@ -526,7 +526,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonNumber() {
number = StringToDouble(isolate()->unicode_cache(),
chars,
NO_FLAGS, // Hex, octal or trailing junk.
- OS::nan_value());
+ base::OS::nan_value());
} else {
Vector<uint8_t> buffer = Vector<uint8_t>::New(length);
String::WriteToFlat(*source_, buffer.start(), beg_pos, position_);
@@ -666,7 +666,7 @@ Handle<String> JsonParser<seq_ascii>::SlowScanJsonString(
}
}
- ASSERT_EQ('"', c0_);
+ DCHECK_EQ('"', c0_);
// Advance past the last '"'.
AdvanceSkipWhitespace();
@@ -678,7 +678,7 @@ Handle<String> JsonParser<seq_ascii>::SlowScanJsonString(
template <bool seq_ascii>
template <bool is_internalized>
Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
- ASSERT_EQ('"', c0_);
+ DCHECK_EQ('"', c0_);
Advance();
if (c0_ == '"') {
AdvanceSkipWhitespace();
@@ -719,7 +719,8 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
} while (c0 != '"');
int length = position - position_;
uint32_t hash = (length <= String::kMaxHashCalcLength)
- ? StringHasher::GetHashCore(running_hash) : length;
+ ? StringHasher::GetHashCore(running_hash)
+ : static_cast<uint32_t>(length);
Vector<const uint8_t> string_vector(
seq_source_->GetChars() + position_, length);
StringTable* string_table = isolate()->heap()->string_table();
@@ -741,7 +742,7 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
#ifdef DEBUG
uint32_t hash_field =
(hash << String::kHashShift) | String::kIsNotArrayIndexMask;
- ASSERT_EQ(static_cast<int>(result->Hash()),
+ DCHECK_EQ(static_cast<int>(result->Hash()),
static_cast<int>(hash_field >> String::kHashShift));
#endif
break;
@@ -779,7 +780,7 @@ Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
uint8_t* dest = SeqOneByteString::cast(*result)->GetChars();
String::WriteToFlat(*source_, dest, beg_pos, position_);
- ASSERT_EQ('"', c0_);
+ DCHECK_EQ('"', c0_);
// Advance past the last '"'.
AdvanceSkipWhitespace();
return result;