Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(655)

Unified Diff: src/objects-inl.h

Issue 639123009: Classes: Add basic support for properties (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: git rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 91bd0092244536b8293999e80640e56f9235a762..33363238c4d28a056421c19d32e1e3935c13bb64 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1930,13 +1930,12 @@ void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) {
}
-HeapObject* WeakCell::value() const {
- return HeapObject::cast(READ_FIELD(this, kValueOffset));
-}
+Object* WeakCell::value() const { return READ_FIELD(this, kValueOffset); }
-void WeakCell::clear(HeapObject* undefined) {
- WRITE_FIELD(this, kValueOffset, undefined);
+void WeakCell::clear() {
+ DCHECK(GetHeap()->gc_state() == Heap::MARK_COMPACT);
+ WRITE_FIELD(this, kValueOffset, Smi::FromInt(0));
}
@@ -1946,6 +1945,9 @@ void WeakCell::initialize(HeapObject* val) {
}
+bool WeakCell::cleared() const { return value() == Smi::FromInt(0); }
+
+
Object* WeakCell::next() const { return READ_FIELD(this, kNextOffset); }
@@ -3691,28 +3693,26 @@ const uint16_t* ExternalTwoByteString::ExternalTwoByteStringGetData(
}
-int ConsStringIteratorOp::OffsetForDepth(int depth) {
- return depth & kDepthMask;
-}
+int ConsStringIterator::OffsetForDepth(int depth) { return depth & kDepthMask; }
-void ConsStringIteratorOp::PushLeft(ConsString* string) {
+void ConsStringIterator::PushLeft(ConsString* string) {
frames_[depth_++ & kDepthMask] = string;
}
-void ConsStringIteratorOp::PushRight(ConsString* string) {
+void ConsStringIterator::PushRight(ConsString* string) {
// Inplace update.
frames_[(depth_-1) & kDepthMask] = string;
}
-void ConsStringIteratorOp::AdjustMaximumDepth() {
+void ConsStringIterator::AdjustMaximumDepth() {
if (depth_ > maximum_depth_) maximum_depth_ = depth_;
}
-void ConsStringIteratorOp::Pop() {
+void ConsStringIterator::Pop() {
DCHECK(depth_ > 0);
DCHECK(depth_ <= maximum_depth_);
depth_--;
@@ -3728,11 +3728,8 @@ uint16_t StringCharacterStream::GetNext() {
}
-StringCharacterStream::StringCharacterStream(String* string,
- ConsStringIteratorOp* op,
- int offset)
- : is_one_byte_(false),
- op_(op) {
+StringCharacterStream::StringCharacterStream(String* string, int offset)
+ : is_one_byte_(false) {
Reset(string, offset);
}
@@ -3741,9 +3738,9 @@ void StringCharacterStream::Reset(String* string, int offset) {
buffer8_ = NULL;
end_ = NULL;
ConsString* cons_string = String::VisitFlat(this, string, offset);
- op_->Reset(cons_string, offset);
+ iter_.Reset(cons_string, offset);
if (cons_string != NULL) {
- string = op_->Next(&offset);
+ string = iter_.Next(&offset);
if (string != NULL) String::VisitFlat(this, string, offset);
}
}
@@ -3752,7 +3749,7 @@ void StringCharacterStream::Reset(String* string, int offset) {
bool StringCharacterStream::HasMore() {
if (buffer8_ != end_) return true;
int offset;
- String* string = op_->Next(&offset);
+ String* string = iter_.Next(&offset);
DCHECK_EQ(offset, 0);
if (string == NULL) return false;
String::VisitFlat(this, string);
@@ -4171,7 +4168,8 @@ typename Traits::ElementType FixedTypedArray<Traits>::from_double(
template<> inline
uint8_t FixedTypedArray<Uint8ClampedArrayTraits>::from_double(double value) {
- if (value < 0) return 0;
+ // Handle NaNs and less than zero values which clamp to zero.
+ if (!(value > 0)) return 0;
if (value > 0xFF) return 0xFF;
return static_cast<uint8_t>(lrint(value));
}
@@ -4833,13 +4831,11 @@ void Code::set_profiler_ticks(int ticks) {
int Code::builtin_index() {
- DCHECK_EQ(BUILTIN, kind());
return READ_INT32_FIELD(this, kKindSpecificFlags1Offset);
}
void Code::set_builtin_index(int index) {
- DCHECK_EQ(BUILTIN, kind());
WRITE_INT32_FIELD(this, kKindSpecificFlags1Offset, index);
}
@@ -6629,9 +6625,9 @@ uint32_t IteratingStringHasher::Hash(String* string, uint32_t seed) {
// The string was flat.
if (cons_string == NULL) return hasher.GetHashField();
// This is a ConsString, iterate across it.
- ConsStringIteratorOp op(cons_string);
+ ConsStringIterator iter(cons_string);
int offset;
- while (NULL != (string = op.Next(&offset))) {
+ while (NULL != (string = iter.Next(&offset))) {
String::VisitFlat(&hasher, string, offset);
}
return hasher.GetHashField();
@@ -6690,11 +6686,6 @@ String* String::GetForwardedInternalizedString() {
}
-Object* JSReceiver::GetConstructor() {
- return map()->constructor();
-}
-
-
Maybe<bool> JSReceiver::HasProperty(Handle<JSReceiver> object,
Handle<Name> name) {
if (object->IsJSProxy()) {
« no previous file with comments | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698