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

Side by Side Diff: src/api.cc

Issue 351853005: Split SetProperty(...attributes, strictmode) into AddProperty(...attributes) and SetProperty(...… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 | « no previous file | src/apinatives.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 3012 matching lines...) Expand 10 before | Expand all | Expand 10 after
3023 EXCEPTION_BAILOUT_CHECK(isolate, 0); 3023 EXCEPTION_BAILOUT_CHECK(isolate, 0);
3024 if (num->IsSmi()) { 3024 if (num->IsSmi()) {
3025 return i::Smi::cast(*num)->value(); 3025 return i::Smi::cast(*num)->value();
3026 } else { 3026 } else {
3027 return static_cast<uint32_t>(num->Number()); 3027 return static_cast<uint32_t>(num->Number());
3028 } 3028 }
3029 } 3029 }
3030 } 3030 }
3031 3031
3032 3032
3033 // TODO(verwaest): Remove the attribs argument, since it doesn't make sense for
3034 // existing properties. Use ForceSet instead to define or redefine properties
3035 // with specific attributes.
3033 bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value, 3036 bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
3034 v8::PropertyAttribute attribs) { 3037 v8::PropertyAttribute attribs) {
3035 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3038 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3036 ON_BAILOUT(isolate, "v8::Object::Set()", return false); 3039 ON_BAILOUT(isolate, "v8::Object::Set()", return false);
3037 ENTER_V8(isolate); 3040 ENTER_V8(isolate);
3038 i::HandleScope scope(isolate); 3041 i::HandleScope scope(isolate);
3039 i::Handle<i::Object> self = Utils::OpenHandle(this); 3042 i::Handle<i::Object> self = Utils::OpenHandle(this);
3040 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 3043 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3041 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 3044 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3042 EXCEPTION_PREAMBLE(isolate); 3045 EXCEPTION_PREAMBLE(isolate);
3043 has_pending_exception = i::Runtime::SetObjectProperty( 3046 has_pending_exception = i::Runtime::SetObjectProperty(
3044 isolate, 3047 isolate, self, key_obj, value_obj, i::SLOPPY,
3045 self, 3048 static_cast<PropertyAttributes>(attribs)).is_null();
3046 key_obj,
3047 value_obj,
3048 static_cast<PropertyAttributes>(attribs),
3049 i::SLOPPY).is_null();
3050 EXCEPTION_BAILOUT_CHECK(isolate, false); 3049 EXCEPTION_BAILOUT_CHECK(isolate, false);
3051 return true; 3050 return true;
3052 } 3051 }
3053 3052
3054 3053
3055 bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) { 3054 bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) {
3056 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3055 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3057 ON_BAILOUT(isolate, "v8::Object::Set()", return false); 3056 ON_BAILOUT(isolate, "v8::Object::Set()", return false);
3058 ENTER_V8(isolate); 3057 ENTER_V8(isolate);
3059 i::HandleScope scope(isolate); 3058 i::HandleScope scope(isolate);
(...skipping 11 matching lines...) Expand all
3071 v8::Handle<Value> value, 3070 v8::Handle<Value> value,
3072 v8::PropertyAttribute attribs) { 3071 v8::PropertyAttribute attribs) {
3073 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3072 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3074 ON_BAILOUT(isolate, "v8::Object::ForceSet()", return false); 3073 ON_BAILOUT(isolate, "v8::Object::ForceSet()", return false);
3075 ENTER_V8(isolate); 3074 ENTER_V8(isolate);
3076 i::HandleScope scope(isolate); 3075 i::HandleScope scope(isolate);
3077 i::Handle<i::JSObject> self = Utils::OpenHandle(this); 3076 i::Handle<i::JSObject> self = Utils::OpenHandle(this);
3078 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key); 3077 i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
3079 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value); 3078 i::Handle<i::Object> value_obj = Utils::OpenHandle(*value);
3080 EXCEPTION_PREAMBLE(isolate); 3079 EXCEPTION_PREAMBLE(isolate);
3081 has_pending_exception = i::Runtime::ForceSetObjectProperty( 3080 has_pending_exception = i::Runtime::DefineObjectProperty(
3082 self, 3081 self,
3083 key_obj, 3082 key_obj,
3084 value_obj, 3083 value_obj,
3085 static_cast<PropertyAttributes>(attribs)).is_null(); 3084 static_cast<PropertyAttributes>(attribs)).is_null();
3086 EXCEPTION_BAILOUT_CHECK(isolate, false); 3085 EXCEPTION_BAILOUT_CHECK(isolate, false);
3087 return true; 3086 return true;
3088 } 3087 }
3089 3088
3090 3089
3091 bool v8::Object::SetPrivate(v8::Handle<Private> key, v8::Handle<Value> value) { 3090 bool v8::Object::SetPrivate(v8::Handle<Private> key, v8::Handle<Value> value) {
(...skipping 4539 matching lines...) Expand 10 before | Expand all | Expand 10 after
7631 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7630 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7632 Address callback_address = 7631 Address callback_address =
7633 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7632 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7634 VMState<EXTERNAL> state(isolate); 7633 VMState<EXTERNAL> state(isolate);
7635 ExternalCallbackScope call_scope(isolate, callback_address); 7634 ExternalCallbackScope call_scope(isolate, callback_address);
7636 callback(info); 7635 callback(info);
7637 } 7636 }
7638 7637
7639 7638
7640 } } // namespace v8::internal 7639 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/apinatives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698