#include "src/char-predicates-inl.h"
#include "src/conversions.h"
+#include "src/heap/spaces-inl.h"
#include "src/messages.h"
-#include "src/spaces-inl.h"
#include "src/token.h"
namespace v8 {
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++) {
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;
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();
}
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)) {
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;
Handle<Object> JsonParser<seq_ascii>::ParseJsonArray() {
HandleScope scope(isolate());
ZoneList<Handle<Object> > elements(4, zone());
- ASSERT_EQ(c0_, '[');
+ DCHECK_EQ(c0_, '[');
AdvanceSkipWhitespace();
if (c0_ != ']') {
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_);
}
}
- ASSERT_EQ('"', c0_);
+ DCHECK_EQ('"', c0_);
// Advance past the last '"'.
AdvanceSkipWhitespace();
template <bool seq_ascii>
template <bool is_internalized>
Handle<String> JsonParser<seq_ascii>::ScanJsonString() {
- ASSERT_EQ('"', c0_);
+ DCHECK_EQ('"', c0_);
Advance();
if (c0_ == '"') {
AdvanceSkipWhitespace();
} 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();
#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;
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;