| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 void SetExpectedNofPropertiesFromEstimate(Handle<SharedFunctionInfo> shared, | 201 void SetExpectedNofPropertiesFromEstimate(Handle<SharedFunctionInfo> shared, |
| 202 int estimate) { | 202 int estimate) { |
| 203 // See the comment in SetExpectedNofProperties. | 203 // See the comment in SetExpectedNofProperties. |
| 204 if (shared->live_objects_may_exist()) return; | 204 if (shared->live_objects_may_exist()) return; |
| 205 | 205 |
| 206 shared->set_expected_nof_properties( | 206 shared->set_expected_nof_properties( |
| 207 ExpectedNofPropertiesFromEstimate(estimate)); | 207 ExpectedNofPropertiesFromEstimate(estimate)); |
| 208 } | 208 } |
| 209 | 209 |
| 210 | 210 |
| 211 void NormalizeProperties(Handle<JSObject> object, | |
| 212 PropertyNormalizationMode mode, | |
| 213 int expected_additional_properties) { | |
| 214 CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), | |
| 215 object->NormalizeProperties( | |
| 216 mode, | |
| 217 expected_additional_properties)); | |
| 218 } | |
| 219 | |
| 220 | |
| 221 Handle<NumberDictionary> NormalizeElements(Handle<JSObject> object) { | |
| 222 CALL_HEAP_FUNCTION(object->GetIsolate(), | |
| 223 object->NormalizeElements(), | |
| 224 NumberDictionary); | |
| 225 } | |
| 226 | |
| 227 | |
| 228 void TransformToFastProperties(Handle<JSObject> object, | |
| 229 int unused_property_fields) { | |
| 230 CALL_HEAP_FUNCTION_VOID( | |
| 231 object->GetIsolate(), | |
| 232 object->TransformToFastProperties(unused_property_fields)); | |
| 233 } | |
| 234 | |
| 235 | |
| 236 Handle<NumberDictionary> NumberDictionarySet( | |
| 237 Handle<NumberDictionary> dictionary, | |
| 238 uint32_t index, | |
| 239 Handle<Object> value, | |
| 240 PropertyDetails details) { | |
| 241 CALL_HEAP_FUNCTION(dictionary->GetIsolate(), | |
| 242 dictionary->Set(index, *value, details), | |
| 243 NumberDictionary); | |
| 244 } | |
| 245 | |
| 246 | |
| 247 void FlattenString(Handle<String> string) { | 211 void FlattenString(Handle<String> string) { |
| 248 CALL_HEAP_FUNCTION_VOID(string->GetIsolate(), string->TryFlatten()); | 212 CALL_HEAP_FUNCTION_VOID(string->GetIsolate(), string->TryFlatten()); |
| 249 } | 213 } |
| 250 | 214 |
| 251 | 215 |
| 252 Handle<String> FlattenGetString(Handle<String> string) { | 216 Handle<String> FlattenGetString(Handle<String> string) { |
| 253 CALL_HEAP_FUNCTION(string->GetIsolate(), string->TryFlatten(), String); | 217 CALL_HEAP_FUNCTION(string->GetIsolate(), string->TryFlatten(), String); |
| 254 } | 218 } |
| 255 | 219 |
| 256 | 220 |
| 257 Handle<Object> SetPrototype(Handle<JSFunction> function, | 221 Handle<Object> SetPrototype(Handle<JSFunction> function, |
| 258 Handle<Object> prototype) { | 222 Handle<Object> prototype) { |
| 259 ASSERT(function->should_have_prototype()); | 223 ASSERT(function->should_have_prototype()); |
| 260 CALL_HEAP_FUNCTION(function->GetIsolate(), | 224 CALL_HEAP_FUNCTION(function->GetIsolate(), |
| 261 Accessors::FunctionSetPrototype(*function, | 225 Accessors::FunctionSetPrototype(*function, |
| 262 *prototype, | 226 *prototype, |
| 263 NULL), | 227 NULL), |
| 264 Object); | 228 Object); |
| 265 } | 229 } |
| 266 | 230 |
| 267 | 231 |
| 268 Handle<Object> SetProperty(Handle<JSReceiver> object, | |
| 269 Handle<String> key, | |
| 270 Handle<Object> value, | |
| 271 PropertyAttributes attributes, | |
| 272 StrictModeFlag strict_mode) { | |
| 273 CALL_HEAP_FUNCTION(object->GetIsolate(), | |
| 274 object->SetProperty(*key, *value, attributes, strict_mode), | |
| 275 Object); | |
| 276 } | |
| 277 | |
| 278 | |
| 279 Handle<Object> SetProperty(Handle<Object> object, | 232 Handle<Object> SetProperty(Handle<Object> object, |
| 280 Handle<Object> key, | 233 Handle<Object> key, |
| 281 Handle<Object> value, | 234 Handle<Object> value, |
| 282 PropertyAttributes attributes, | 235 PropertyAttributes attributes, |
| 283 StrictModeFlag strict_mode) { | 236 StrictModeFlag strict_mode) { |
| 284 Isolate* isolate = Isolate::Current(); | 237 Isolate* isolate = Isolate::Current(); |
| 285 CALL_HEAP_FUNCTION( | 238 CALL_HEAP_FUNCTION( |
| 286 isolate, | 239 isolate, |
| 287 Runtime::SetObjectProperty( | 240 Runtime::SetObjectProperty( |
| 288 isolate, object, key, value, attributes, strict_mode), | 241 isolate, object, key, value, attributes, strict_mode), |
| 289 Object); | 242 Object); |
| 290 } | 243 } |
| 291 | 244 |
| 292 | 245 |
| 293 Handle<Object> ForceSetProperty(Handle<JSObject> object, | 246 Handle<Object> ForceSetProperty(Handle<JSObject> object, |
| 294 Handle<Object> key, | 247 Handle<Object> key, |
| 295 Handle<Object> value, | 248 Handle<Object> value, |
| 296 PropertyAttributes attributes) { | 249 PropertyAttributes attributes) { |
| 297 Isolate* isolate = object->GetIsolate(); | 250 Isolate* isolate = object->GetIsolate(); |
| 298 CALL_HEAP_FUNCTION( | 251 CALL_HEAP_FUNCTION( |
| 299 isolate, | 252 isolate, |
| 300 Runtime::ForceSetObjectProperty( | 253 Runtime::ForceSetObjectProperty( |
| 301 isolate, object, key, value, attributes), | 254 isolate, object, key, value, attributes), |
| 302 Object); | 255 Object); |
| 303 } | 256 } |
| 304 | 257 |
| 305 | 258 |
| 306 Handle<Object> SetNormalizedProperty(Handle<JSObject> object, | |
| 307 Handle<String> key, | |
| 308 Handle<Object> value, | |
| 309 PropertyDetails details) { | |
| 310 CALL_HEAP_FUNCTION(object->GetIsolate(), | |
| 311 object->SetNormalizedProperty(*key, *value, details), | |
| 312 Object); | |
| 313 } | |
| 314 | |
| 315 | |
| 316 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, | 259 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, |
| 317 Handle<Object> key) { | 260 Handle<Object> key) { |
| 318 Isolate* isolate = object->GetIsolate(); | 261 Isolate* isolate = object->GetIsolate(); |
| 319 CALL_HEAP_FUNCTION(isolate, | 262 CALL_HEAP_FUNCTION(isolate, |
| 320 Runtime::ForceDeleteObjectProperty(isolate, object, key), | 263 Runtime::ForceDeleteObjectProperty(isolate, object, key), |
| 321 Object); | 264 Object); |
| 322 } | 265 } |
| 323 | 266 |
| 324 | 267 |
| 325 Handle<Object> SetLocalPropertyIgnoreAttributes( | |
| 326 Handle<JSObject> object, | |
| 327 Handle<String> key, | |
| 328 Handle<Object> value, | |
| 329 PropertyAttributes attributes) { | |
| 330 CALL_HEAP_FUNCTION( | |
| 331 object->GetIsolate(), | |
| 332 object->SetLocalPropertyIgnoreAttributes(*key, *value, attributes), | |
| 333 Object); | |
| 334 } | |
| 335 | |
| 336 | |
| 337 void SetLocalPropertyNoThrow(Handle<JSObject> object, | |
| 338 Handle<String> key, | |
| 339 Handle<Object> value, | |
| 340 PropertyAttributes attributes) { | |
| 341 Isolate* isolate = object->GetIsolate(); | |
| 342 ASSERT(!isolate->has_pending_exception()); | |
| 343 CHECK(!SetLocalPropertyIgnoreAttributes( | |
| 344 object, key, value, attributes).is_null()); | |
| 345 CHECK(!isolate->has_pending_exception()); | |
| 346 } | |
| 347 | |
| 348 | |
| 349 Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object, | 268 Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object, |
| 350 Handle<String> key, | 269 Handle<String> key, |
| 351 Handle<Object> value, | 270 Handle<Object> value, |
| 352 PropertyAttributes attributes, | 271 PropertyAttributes attributes, |
| 353 StrictModeFlag strict_mode) { | 272 StrictModeFlag strict_mode) { |
| 354 CALL_HEAP_FUNCTION(object->GetIsolate(), | 273 CALL_HEAP_FUNCTION(object->GetIsolate(), |
| 355 object->SetPropertyWithInterceptor(*key, | 274 object->SetPropertyWithInterceptor(*key, |
| 356 *value, | 275 *value, |
| 357 attributes, | 276 attributes, |
| 358 strict_mode), | 277 strict_mode), |
| (...skipping 23 matching lines...) Expand all Loading... |
| 382 PropertyAttributes* attributes) { | 301 PropertyAttributes* attributes) { |
| 383 Isolate* isolate = receiver->GetIsolate(); | 302 Isolate* isolate = receiver->GetIsolate(); |
| 384 CALL_HEAP_FUNCTION(isolate, | 303 CALL_HEAP_FUNCTION(isolate, |
| 385 holder->GetPropertyWithInterceptor(*receiver, | 304 holder->GetPropertyWithInterceptor(*receiver, |
| 386 *name, | 305 *name, |
| 387 attributes), | 306 attributes), |
| 388 Object); | 307 Object); |
| 389 } | 308 } |
| 390 | 309 |
| 391 | 310 |
| 392 Handle<Object> GetPrototype(Handle<Object> obj) { | |
| 393 Handle<Object> result(obj->GetPrototype()); | |
| 394 return result; | |
| 395 } | |
| 396 | |
| 397 | |
| 398 Handle<Object> SetPrototype(Handle<JSObject> obj, Handle<Object> value) { | 311 Handle<Object> SetPrototype(Handle<JSObject> obj, Handle<Object> value) { |
| 399 const bool skip_hidden_prototypes = false; | 312 const bool skip_hidden_prototypes = false; |
| 400 CALL_HEAP_FUNCTION(obj->GetIsolate(), | 313 CALL_HEAP_FUNCTION(obj->GetIsolate(), |
| 401 obj->SetPrototype(*value, skip_hidden_prototypes), Object); | 314 obj->SetPrototype(*value, skip_hidden_prototypes), Object); |
| 402 } | 315 } |
| 403 | 316 |
| 404 | 317 |
| 405 Handle<Object> PreventExtensions(Handle<JSObject> object) { | |
| 406 CALL_HEAP_FUNCTION(object->GetIsolate(), object->PreventExtensions(), Object); | |
| 407 } | |
| 408 | |
| 409 | |
| 410 Handle<Object> SetHiddenProperty(Handle<JSObject> obj, | |
| 411 Handle<String> key, | |
| 412 Handle<Object> value) { | |
| 413 CALL_HEAP_FUNCTION(obj->GetIsolate(), | |
| 414 obj->SetHiddenProperty(*key, *value), | |
| 415 Object); | |
| 416 } | |
| 417 | |
| 418 | |
| 419 int GetIdentityHash(Handle<JSReceiver> obj) { | |
| 420 CALL_AND_RETRY(obj->GetIsolate(), | |
| 421 obj->GetIdentityHash(ALLOW_CREATION), | |
| 422 return Smi::cast(__object__)->value(), | |
| 423 return 0); | |
| 424 } | |
| 425 | |
| 426 | |
| 427 Handle<Object> DeleteElement(Handle<JSObject> obj, | |
| 428 uint32_t index) { | |
| 429 CALL_HEAP_FUNCTION(obj->GetIsolate(), | |
| 430 obj->DeleteElement(index, JSObject::NORMAL_DELETION), | |
| 431 Object); | |
| 432 } | |
| 433 | |
| 434 | |
| 435 Handle<Object> DeleteProperty(Handle<JSObject> obj, | |
| 436 Handle<String> prop) { | |
| 437 CALL_HEAP_FUNCTION(obj->GetIsolate(), | |
| 438 obj->DeleteProperty(*prop, JSObject::NORMAL_DELETION), | |
| 439 Object); | |
| 440 } | |
| 441 | |
| 442 | |
| 443 Handle<Object> LookupSingleCharacterStringFromCode(uint32_t index) { | 318 Handle<Object> LookupSingleCharacterStringFromCode(uint32_t index) { |
| 444 Isolate* isolate = Isolate::Current(); | 319 Isolate* isolate = Isolate::Current(); |
| 445 CALL_HEAP_FUNCTION( | 320 CALL_HEAP_FUNCTION( |
| 446 isolate, | 321 isolate, |
| 447 isolate->heap()->LookupSingleCharacterStringFromCode(index), Object); | 322 isolate->heap()->LookupSingleCharacterStringFromCode(index), Object); |
| 448 } | 323 } |
| 449 | 324 |
| 450 | 325 |
| 451 Handle<String> SubString(Handle<String> str, | 326 Handle<String> SubString(Handle<String> str, |
| 452 int start, | 327 int start, |
| 453 int end, | 328 int end, |
| 454 PretenureFlag pretenure) { | 329 PretenureFlag pretenure) { |
| 455 CALL_HEAP_FUNCTION(str->GetIsolate(), | 330 CALL_HEAP_FUNCTION(str->GetIsolate(), |
| 456 str->SubString(start, end, pretenure), String); | 331 str->SubString(start, end, pretenure), String); |
| 457 } | 332 } |
| 458 | 333 |
| 459 | 334 |
| 460 Handle<Object> SetElement(Handle<JSObject> object, | |
| 461 uint32_t index, | |
| 462 Handle<Object> value, | |
| 463 StrictModeFlag strict_mode) { | |
| 464 if (object->HasExternalArrayElements()) { | |
| 465 if (!value->IsSmi() && !value->IsHeapNumber() && !value->IsUndefined()) { | |
| 466 bool has_exception; | |
| 467 Handle<Object> number = Execution::ToNumber(value, &has_exception); | |
| 468 if (has_exception) return Handle<Object>(); | |
| 469 value = number; | |
| 470 } | |
| 471 } | |
| 472 CALL_HEAP_FUNCTION(object->GetIsolate(), | |
| 473 object->SetElement(index, *value, strict_mode, true), | |
| 474 Object); | |
| 475 } | |
| 476 | |
| 477 | |
| 478 Handle<Object> SetOwnElement(Handle<JSObject> object, | |
| 479 uint32_t index, | |
| 480 Handle<Object> value, | |
| 481 StrictModeFlag strict_mode) { | |
| 482 ASSERT(!object->HasExternalArrayElements()); | |
| 483 CALL_HEAP_FUNCTION(object->GetIsolate(), | |
| 484 object->SetElement(index, *value, strict_mode, false), | |
| 485 Object); | |
| 486 } | |
| 487 | |
| 488 | |
| 489 Handle<Object> TransitionElementsKind(Handle<JSObject> object, | |
| 490 ElementsKind to_kind) { | |
| 491 CALL_HEAP_FUNCTION(object->GetIsolate(), | |
| 492 object->TransitionElementsKind(to_kind), | |
| 493 Object); | |
| 494 } | |
| 495 | |
| 496 | |
| 497 Handle<JSObject> Copy(Handle<JSObject> obj) { | 335 Handle<JSObject> Copy(Handle<JSObject> obj) { |
| 498 Isolate* isolate = obj->GetIsolate(); | 336 Isolate* isolate = obj->GetIsolate(); |
| 499 CALL_HEAP_FUNCTION(isolate, | 337 CALL_HEAP_FUNCTION(isolate, |
| 500 isolate->heap()->CopyJSObject(*obj), JSObject); | 338 isolate->heap()->CopyJSObject(*obj), JSObject); |
| 501 } | 339 } |
| 502 | 340 |
| 503 | 341 |
| 504 Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info) { | 342 Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info) { |
| 505 CALL_HEAP_FUNCTION(obj->GetIsolate(), obj->DefineAccessor(*info), Object); | 343 CALL_HEAP_FUNCTION(obj->GetIsolate(), obj->DefineAccessor(*info), Object); |
| 506 } | 344 } |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 Handle<ObjectHashTable> PutIntoObjectHashTable(Handle<ObjectHashTable> table, | 763 Handle<ObjectHashTable> PutIntoObjectHashTable(Handle<ObjectHashTable> table, |
| 926 Handle<Object> key, | 764 Handle<Object> key, |
| 927 Handle<Object> value) { | 765 Handle<Object> value) { |
| 928 CALL_HEAP_FUNCTION(table->GetIsolate(), | 766 CALL_HEAP_FUNCTION(table->GetIsolate(), |
| 929 table->Put(*key, *value), | 767 table->Put(*key, *value), |
| 930 ObjectHashTable); | 768 ObjectHashTable); |
| 931 } | 769 } |
| 932 | 770 |
| 933 | 771 |
| 934 } } // namespace v8::internal | 772 } } // namespace v8::internal |
| OLD | NEW |