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

Side by Side Diff: runtime/vm/object.cc

Issue 1056223002: Fix crash when posting a message to a send port with port id 0. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/port.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 20052 matching lines...) Expand 10 before | Expand all | Expand 10 after
20063 20063
20064 20064
20065 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const { 20065 void Capability::PrintJSONImpl(JSONStream* stream, bool ref) const {
20066 Instance::PrintJSONImpl(stream, ref); 20066 Instance::PrintJSONImpl(stream, ref);
20067 } 20067 }
20068 20068
20069 20069
20070 RawReceivePort* ReceivePort::New(Dart_Port id, 20070 RawReceivePort* ReceivePort::New(Dart_Port id,
20071 bool is_control_port, 20071 bool is_control_port,
20072 Heap::Space space) { 20072 Heap::Space space) {
20073 ASSERT(id != ILLEGAL_PORT);
20073 Isolate* isolate = Isolate::Current(); 20074 Isolate* isolate = Isolate::Current();
20074 const SendPort& send_port = 20075 const SendPort& send_port =
20075 SendPort::Handle(isolate, SendPort::New(id, isolate->origin_id())); 20076 SendPort::Handle(isolate, SendPort::New(id, isolate->origin_id()));
20076 20077
20077 ReceivePort& result = ReceivePort::Handle(isolate); 20078 ReceivePort& result = ReceivePort::Handle(isolate);
20078 { 20079 {
20079 RawObject* raw = Object::Allocate(ReceivePort::kClassId, 20080 RawObject* raw = Object::Allocate(ReceivePort::kClassId,
20080 ReceivePort::InstanceSize(), 20081 ReceivePort::InstanceSize(),
20081 space); 20082 space);
20082 NoSafepointScope no_safepoint; 20083 NoSafepointScope no_safepoint;
(...skipping 20 matching lines...) Expand all
20103 20104
20104 20105
20105 RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) { 20106 RawSendPort* SendPort::New(Dart_Port id, Heap::Space space) {
20106 return New(id, Isolate::Current()->origin_id(), space); 20107 return New(id, Isolate::Current()->origin_id(), space);
20107 } 20108 }
20108 20109
20109 20110
20110 RawSendPort* SendPort::New(Dart_Port id, 20111 RawSendPort* SendPort::New(Dart_Port id,
20111 Dart_Port origin_id, 20112 Dart_Port origin_id,
20112 Heap::Space space) { 20113 Heap::Space space) {
20114 ASSERT(id != ILLEGAL_PORT);
20113 SendPort& result = SendPort::Handle(); 20115 SendPort& result = SendPort::Handle();
20114 { 20116 {
20115 RawObject* raw = Object::Allocate(SendPort::kClassId, 20117 RawObject* raw = Object::Allocate(SendPort::kClassId,
20116 SendPort::InstanceSize(), 20118 SendPort::InstanceSize(),
20117 space); 20119 space);
20118 NoSafepointScope no_safepoint; 20120 NoSafepointScope no_safepoint;
20119 result ^= raw; 20121 result ^= raw;
20120 result.StoreNonPointer(&result.raw_ptr()->id_, id); 20122 result.StoreNonPointer(&result.raw_ptr()->id_, id);
20121 result.StoreNonPointer(&result.raw_ptr()->origin_id_, origin_id); 20123 result.StoreNonPointer(&result.raw_ptr()->origin_id_, origin_id);
20122 } 20124 }
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
20717 return tag_label.ToCString(); 20719 return tag_label.ToCString();
20718 } 20720 }
20719 20721
20720 20722
20721 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20723 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20722 Instance::PrintJSONImpl(stream, ref); 20724 Instance::PrintJSONImpl(stream, ref);
20723 } 20725 }
20724 20726
20725 20727
20726 } // namespace dart 20728 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl_test.cc ('k') | runtime/vm/port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698