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

Side by Side Diff: src/objects-body-descriptors-inl.h

Issue 2799943002: Handle ExternalStrings directly in the serializer without ObjectVisitor. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ 5 #ifndef V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
6 #define V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ 6 #define V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
7 7
8 #include "src/assembler-inl.h" 8 #include "src/assembler-inl.h"
9 #include "src/objects-body-descriptors.h" 9 #include "src/objects-body-descriptors.h"
10 #include "src/transitions.h" 10 #include "src/transitions.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 static inline int SizeOf(Map* map, HeapObject* object) { return kSize; } 347 static inline int SizeOf(Map* map, HeapObject* object) { return kSize; }
348 }; 348 };
349 349
350 class ExternalOneByteString::BodyDescriptor final : public BodyDescriptorBase { 350 class ExternalOneByteString::BodyDescriptor final : public BodyDescriptorBase {
351 public: 351 public:
352 static bool IsValidSlot(HeapObject* obj, int offset) { return false; } 352 static bool IsValidSlot(HeapObject* obj, int offset) { return false; }
353 353
354 template <typename ObjectVisitor> 354 template <typename ObjectVisitor>
355 static inline void IterateBody(HeapObject* obj, int object_size, 355 static inline void IterateBody(HeapObject* obj, int object_size,
356 ObjectVisitor* v) { 356 ObjectVisitor* v) {
357 typedef v8::String::ExternalOneByteStringResource Resource;
358 v->VisitExternalOneByteString(reinterpret_cast<Resource**>(
359 HeapObject::RawField(obj, kResourceOffset)));
360 } 357 }
361 358
362 template <typename StaticVisitor> 359 template <typename StaticVisitor>
363 static inline void IterateBody(HeapObject* obj, int object_size) { 360 static inline void IterateBody(HeapObject* obj, int object_size) {
364 typedef v8::String::ExternalOneByteStringResource Resource;
365 StaticVisitor::VisitExternalOneByteString(reinterpret_cast<Resource**>(
366 HeapObject::RawField(obj, kResourceOffset)));
367 } 361 }
368 362
369 static inline int SizeOf(Map* map, HeapObject* object) { return kSize; } 363 static inline int SizeOf(Map* map, HeapObject* object) { return kSize; }
370 }; 364 };
371 365
372 class ExternalTwoByteString::BodyDescriptor final : public BodyDescriptorBase { 366 class ExternalTwoByteString::BodyDescriptor final : public BodyDescriptorBase {
373 public: 367 public:
374 static bool IsValidSlot(HeapObject* obj, int offset) { return false; } 368 static bool IsValidSlot(HeapObject* obj, int offset) { return false; }
375 369
376 template <typename ObjectVisitor> 370 template <typename ObjectVisitor>
377 static inline void IterateBody(HeapObject* obj, int object_size, 371 static inline void IterateBody(HeapObject* obj, int object_size,
378 ObjectVisitor* v) { 372 ObjectVisitor* v) {
379 typedef v8::String::ExternalStringResource Resource;
380 v->VisitExternalTwoByteString(reinterpret_cast<Resource**>(
381 HeapObject::RawField(obj, kResourceOffset)));
382 } 373 }
383 374
384 template <typename StaticVisitor> 375 template <typename StaticVisitor>
385 static inline void IterateBody(HeapObject* obj, int object_size) { 376 static inline void IterateBody(HeapObject* obj, int object_size) {
386 typedef v8::String::ExternalStringResource Resource;
387 StaticVisitor::VisitExternalTwoByteString(reinterpret_cast<Resource**>(
388 HeapObject::RawField(obj, kResourceOffset)));
389 } 377 }
390 378
391 static inline int SizeOf(Map* map, HeapObject* object) { return kSize; } 379 static inline int SizeOf(Map* map, HeapObject* object) { return kSize; }
392 }; 380 };
393 381
394 class Code::BodyDescriptor final : public BodyDescriptorBase { 382 class Code::BodyDescriptor final : public BodyDescriptorBase {
395 public: 383 public:
396 STATIC_ASSERT(kRelocationInfoOffset + kPointerSize == kHandlerTableOffset); 384 STATIC_ASSERT(kRelocationInfoOffset + kPointerSize == kHandlerTableOffset);
397 STATIC_ASSERT(kHandlerTableOffset + kPointerSize == 385 STATIC_ASSERT(kHandlerTableOffset + kPointerSize ==
398 kDeoptimizationDataOffset); 386 kDeoptimizationDataOffset);
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 639
652 template <typename ObjectVisitor> 640 template <typename ObjectVisitor>
653 void HeapObject::IterateBodyFast(InstanceType type, int object_size, 641 void HeapObject::IterateBodyFast(InstanceType type, int object_size,
654 ObjectVisitor* v) { 642 ObjectVisitor* v) {
655 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v); 643 BodyDescriptorApply<CallIterateBody, void>(type, this, object_size, v);
656 } 644 }
657 } // namespace internal 645 } // namespace internal
658 } // namespace v8 646 } // namespace v8
659 647
660 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_ 648 #endif // V8_OBJECTS_BODY_DESCRIPTORS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/snapshot/serializer.h » ('j') | src/snapshot/serializer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698